Getting data from Access

Results 1 to 2 of 2

Thread: Getting data from Access

  1. #1
    Join Date
    Dec 1969

    Default Getting data from Access

    Heres the setting. I am trying to pull information from a Access table to fill a drop down menu in a form, but it is not working.<BR><BR>Whats wrong with my code????<BR><BR> &#060;%<BR> sTestSQL = "SELECT LOCATION FROM LocationLookupTBL ORDER BY LOCATION"<BR><BR> Set Conn = Server.CreateObject("ADODB.Connection")<BR> Conn.Open "DSN=Blah;PWD=BlahBlah"<BR> <BR> <BR> Set rsTest = Conn.execute(sTestSQL)<BR> aTest = rsTest.GetRows <BR> <BR> rsTest.Close<BR> Set rsTest = Nothing<BR> Conn.Close<BR> Set Conn = Nothing<BR> <BR> For nX = 0 To UBound(aTest,2)<BR> Response.Write "&#060;Option value=&#039" & aTest(0, nX) & "&#039selected&#062;" & aTest(1, nX) & "&#060;/option&#062;"<BR> Next<BR> <BR> Redim aTest(0,0)<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Getting data from Access

    The following is the code which pulls out name from access table and shows it in a drop down list box.<BR>---------<BR>&#060;%<BR>myDSN = "DSN=test"<BR>set conntemp = server.CreateObject ("ADODB.connection")<BR>conntemp.Open myDSN<BR><BR>mySQL = "select fname, lname from blahblah"<BR>set rstemp = conntemp.Execute (mySQL)<BR><BR>if rstemp.eof then<BR> Response.Write "No Data Found<BR>"<BR> conntemp.Close<BR> set conntemp = nothing<BR> Response.End<BR>end if<BR><BR>%&#062;<BR>&#060;form action="blahblah.asp" method = "get"&#062; <BR>&#060;SELECT id=ddlDltList name=ddlDltList style="HEIGHT: 22px; WIDTH: 115px"&#062; <BR>&#060;% <BR>do until rstemp.eof<BR>%&#062; <BR><BR>&#060;OPTION&#062; &#060;% = rstemp(0)%&#062;&#060;/OPTION&#062; <BR>&#060;%<BR>rstemp.movenext<BR>loop<BR>rstemp.c lose<BR>set rstemp = nothing<BR>conntemp.Close<BR>set conntemp = nothing<BR><BR>this may or maynot help you. Just send you what i know<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