problems w/ sql query reading variables from a for

Results 1 to 2 of 2

Thread: problems w/ sql query reading variables from a for

  1. #1
    ed h Guest

    Default problems w/ sql query reading variables from a for

    &#060;%<BR>test= TRIM( Request.form("discipline") )<BR>Response.Write test<BR><BR> Set con = Server.CreateObject ("ADODB.Connection")<BR> Call con.Open("equine3","","")<BR> Dim orsa<BR> Set orsa = Server.CreateObject("ADODB.Recordset")<BR> sqltext = "SELECT t_disciplinetrans.disciplineid, t_disciplinetrans.animalid"<BR> sqltext = sqltext& " FROM t_disciplinetrans"<BR> sqltext = sqltext& " WHERE t_disciplinetrans.disciplineid=" & test & ";"<BR> Const adOpenStatic = 2<BR> Const adLockOptimistic =3<BR> Const adCmdText = 1<BR> Call orsa.Open(sqltext, con, adOpenStatic, adLockOptimistic, adCmdText)<BR> orsa.MoveFirst<BR><BR>THIS IS A ASP PAGE THAT IS POSTED FROM ANOTHER ASP PAGE. THE "DISCIPLINE" VARIABLE AT THE TOP HAS BEEN PASSED FROM THE FORM PAGE AND TRANFERRED TO THE "TEST" VARIABLE FOR DEBUGGING PURPOSES. I HAVE TRIED THE DIRECT APPROACH BUT GET NO RESULTING RECORDS, EVEN THOUGH THEY EXISTS. THE VARIABLE FROM THE FORM PAGE SHOWS UP NICELY BUT MUST NOT BE READ BY THE SQL QUERY BECAUSE NO RECORDS ARE LISTED AFTER IT RUNS. ANY SUGGESTIONS?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: problems w/ sql query reading variables from a

    Just before the call to orsa.Open, do<BR><BR>Response.Write "&#060;HR&#062;" & sqltext & "&#060;HR&#062;"<BR><BR>then take that displayed query and try it out in your database tool (that is, not in ASP at all) and see what you get.<BR><BR>If that returns records but the ASP code doesn&#039t...then I&#039m stumped for now.<BR><BR>Minor note: You do not need or want that last line (orsa.MoveFirst) that you are showing. It does absolutely nothing of value.<BR><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