Trouble in a Query

Results 1 to 5 of 5

Thread: Trouble in a Query

  1. #1
    Join Date
    Dec 1969
    Posts
    197

    Default Trouble in a Query

    Hi, I wrote the code below, based on a sample, but keep receiving an error message indicating too few parameters on the Rset open Query line. Could someone give me a help ? thanks.<BR><BR>set Rset = Server.CreateObject("ADODB.RecordSet")<BR>Par = Request.Form("Pacient_Code")<BR>Query = "SELECT Pacients.C_Pacients, Pacients.Name FROM Pacients WHERE C_Pacient = &#039" & Par & "&#039"<BR>Rset.Open Query,"DSN=Pacien;DBQ=C:inetpubwwwrootprof1Pacien. mdb;DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5;"<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    119

    Default RE: Trouble in a Query

    &nbsp;<BR>Hi jose<BR><BR> there are 5 parameters for recordset.open<BR> 1)query name 2)active connection 3)cursor type<BR> 4)locking mode 5)type of query<BR><BR> you are using only 2 parameters , try to use all of them<BR> and see it works or not<BR><BR> i hope this should do<BR><BR> Arvind.

  3. #3
    Jeff Stana Guest

    Default RE: Trouble in a Query

    Try either a system DSN or more likely, a DSN-less connection, as follows:<BR><BR>Rset.Open Session("Pacien_ConnectionString") = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/Pacien.mdb")<BR><BR>Then shake out any query problems.<BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    197

    Default RE: Trouble in a Query

    Arvind, thanks for this.<BR>I&#039m kind of a newbie; could you give a sample ?


  5. #5
    Join Date
    Dec 1969
    Posts
    119

    Default RE: Trouble in a Query

    &nbsp;<BR>Jose<BR> here u go<BR><BR> sql = "select * from table1"<BR> rs.active connection = &#060;connection name&#062; say conn1<BR><BR> rs.open sql,conn1,adopenkeyset,adlockoptimistic,adcmdtext< BR>

Posting Permissions

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