Error message you guys can probably figure out

Results 1 to 5 of 5

Thread: Error message you guys can probably figure out

  1. #1
    David Highlander Guest

    Default Error message you guys can probably figure out

    You guys are gods - can you tell me why i am getting the following error: (code is below)<BR><BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect. <BR><BR>/linklist/index.asp, line 5 <BR><BR><BR>THIS IS THE CODE:<BR><BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;%<BR>set conn = server.createobject ("adodb.connection")<BR> "linklist"<BR>set RSLinks = conn.Execute("select LinkName, LinkLocation, from GULinkList " _<BR> & "order by LinkName")<BR>%&#062;<BR><BR>What have I done wrong? <BR><BR>

  2. #2
    gsn Guest

    Default RE: Error message you guys can probably figure out

    First of all: why don&#039t you split it up to make it more clear:<BR><BR>&#060;%<BR>set conn = Server.CreateObject("ADODB.Connection")<BR>&#039se t your DSN ("linklist"), username (""), and password ("")<BR> "linklist", "", ""<BR>&#039open the recordset and name it "RSLinks"<BR>Set RSLinks = Server.CreateObject("ADODB.Recordset")<BR>&#039the n query the database selecting all the fields<BR>&#039from table "GULinkList"<BR>sqlLinks = "SELECT * FROM GULinkList ORDER BY LinkName"<BR>&#039now go and open the records using the query "sqlLinks"<BR>&#039and the connection "conn"<BR>RSLinks.Open sqlLinks, conn<BR>%&#062;<BR><BR>That should probably do it. The "*" selects all the fields which is ok if you don&#039t have a lot of traffic on your server. That way you have some more flexibility as you populate the page with db-output. But there is certainly nothing wrong about defining them...<BR>

  3. #3
    Neil Popham Guest

    Default RE: Error message you guys can probably figure out

    i must be a god because when i walk into a room people say &#039oh god!&#039...<BR><BR>i dont understand the & "linklist"&#039 line, shouldn&#039t it be:<BR><BR>&#062; "DSN=linklist"<BR>or<BR>&#062; linklist &#039 where linklist is a variable<BR><BR>anyways i think the problem may be the comma after &#039LinkLocation&#039 - it is expecting another field. the lines should be:<BR><BR>&#062; set RSLinks = conn.Execute("select LinkName, LinkLocation from GULinkList " _<BR>&#062; & "order by LinkName")

  4. #4
    David Highlander Guest

    Default Found the error

    The problem was I had one extra comma.<BR><BR>To answer your question you do not need to have the letters "DSN=" in front of the database you are connected to. I see that in a lot fo books and wonder why they do it. You can do it but it is necessary.

  5. #5
    Gerald Nelson McKenzie Guest

    Default RE: Found the error

    You&#039re right, it might not be necessary but it&#039s a good coding practice to put "DSN=" always, when your code is more readable it&#039s also easier to maintain.

Posting Permissions

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