Problems connecting to database

Results 1 to 2 of 2

Thread: Problems connecting to database

  1. #1
    Jason Guest

    Default Problems connecting to database

    I&#039m trying to connect to an Oracle DB. I followed the script in the Database FAQ. I still can not connect. Here is my code:<BR><BR>Dim objRS<BR>Dim strSQL<BR>Dim objConn<BR><BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR><BR>objC onn.Open "DSN=name"<BR><BR>const C_AM = ccs.t_table<BR><BR>strSQL = "SELECT "&C_AM& ".fieldid, "&C_AM& ".fieldname FROM "&C_AM& "<BR><BR>objRS.Open strSQL, objConn<BR><BR>The reason I think this doesnt work is that when I debug it in Interdev. The listbox that I use are not populated. Here is the code for the listbox:<BR><BR>&#060;SELECT id=id name=id&#062;<BR> &#060;%Do while NOT objRS.EOF%&#062;<BR> &#060;OPTION VALUE="&#060;%=objRS("fieldid")%&#062;"&#062;&#060 ;%=objRS("fieldname")%&#062;&#060;/OPTION&#062;<BR> &#060;%<BR> objRS.MoveNext<BR> loop<BR> %&#062;<BR> &#060;/SELECT&#062;<BR><BR>Can some please help. This is driving me crazy.

  2. #2
    Join Date
    Dec 1969

    Default RE: Problems connecting to database

    Jason, Try this.<BR><BR>Dim objRS<BR>Dim strSQL<BR>Dim objConn<BR><BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>objConn .ConnectionString = "DSN=name" &#039 Make sure NAME is the name of your ODBC connection.<BR>objConn.Open <BR><BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR><BR>Not sure if it would help, but I alsways thought you needed the COnnectionString set :)<BR><BR>Have fun<BR>Renee :o)

Posting Permissions

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