Results 1 to 2 of 2

Thread: Small SQL problem

  1. #1
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Small SQL problem

    Guys,

    I am stacked with what seems to be a very simple problem.
    Here is the segment of code I am working on:

    fPersonal = request.Form("fPersonalID")
    Response.Write(fPersonal)
    SQL = "SELECT Alias FROM Personal WHERE PersonalID = fPersonal"
    set rs = cn.execute(SQL)
    if rs.eof then
    response.redirect "wpersonallist.asp?error=1"
    else
    falias = rs("Alias")
    end if

    For some reason the code produce the following error:

    5
    Microsoft JET Database Engine error '80040e10'
    No value given for one or more required parameters.
    /personalWT/wpersonallist_proc.asp, line 61

    As you can see, the variable fPersonal takes a numeric value of 5 but
    produces an error. When I replace fPersonal by 5 in the code:
    SQL = "SELECT Alias FROM Personal WHERE PersonalID = 5"
    everything works.

    Please, help
    Regards
    Last edited by Snookerman; 06-14-2009 at 02:37 PM.

  2. #2
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem resolved

    Sorry, guys, I have resolved the issue.
    It was really too simple.
    The SQL statement should be:
    SQL = "SELECT Alias FROM Personal WHERE PersonalID = " & fPersonal
    Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •