Results 1 to 2 of 2

Thread: ADO

  1. #1
    lost in nyc Guest

    Default ADO

    I created a DB called testdb in Access. I loaded it on a web server and added it to OBDC system DSN.<BR>I am running an asp script that is trying to extract the lastname using a WHERE clause.<BR>I am receiving "Too few parameters. Expected 1" error.<BR>I have tried it using numerics(ssn field), hardcoding a string(chin) and using a variable(ln).<BR>Any ideas Thanks <BR><BR>Here is the code.<BR> <BR>&#060;%@ Language = VBscript %&#062;<BR>&#060;%<BR>&#039Declare variables.<BR>Dim MYSQL<BR>Dim Conn<BR>Dim res<BR>dim ln<BR>ln = "chin"<BR>&#039*** Select<BR>&#039MYSQL="SELECT lname FROM emp WHERE ssn = 123456789"<BR>MYSQL="SELECT lname FROM emp WHERE lname = &#039" & ln & "&#039" <BR>&#039MYSQL="SELECT fname FROM emp WHERE lname= &#039chin&#039 " <BR><BR>set Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Op en "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:wwwrootill estdb.mdb"<BR><BR>set res=Conn.execute(MYSQL)<BR>&#039************<BR>Co nn.Close "testdb1"<BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ADO

    The &#039expected paramaters&#039 means part of your query is missing. Do this to debug:<BR>...(your code)<BR>response.write MYSQL & " $$<BR>"<BR>set res=conn.execute(MYSQL)<BR><BR>This will write out your query. I added the $$ so if the query is empty, you&#039ll see the $$ print and know it&#039s empty.<BR>good luck.

Posting Permissions

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