Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: Why am I getting this message?


Message #1 by vulien@y... on Thu, 10 May 2001 22:40:36
Hi, 



I am new to ASP and am having problem whenever I tried to connect to my 

database, I keep getting "Invalid Data string" message.  This is what I 

have:



<%

  Dim vConnect

  

  Set vConnect = Server.CreateObject("prjTest.cDataCon")



  vConnect.Connect



%>



I wrote a class in VB called cDataCon, all it does is connect to my 

database and execute my SQL statements but everytime I run my VB project 

and try to view the first page I got the above message.  I am postin what 

I have in VB, can someone please take a look and tell me if I am missing 

anything?  This is my VB code:



cDataCon



Option Explicit

' Referecing Microsoft ActiveX Data Objects 2.1 Library

' Use for connection to the database and execute SQL Statement

Private mConn As ADODB.Connection



Private Sub Class_Initialize()

    Set mConn = New ADODB.Connection

End Sub



Public Sub Connect()

    With mConn

        .ConnectionString = "Driver=Microsoft Access Driver (*.mdb);DBQ=" 

& App.Path & "\..\Database\Test.mdb;"

        .Open

    End With

End Sub





Public Sub ExecuteSQL(SQLString As String)

    

    mConn.Execute (SQLString)

End Sub





Public Function GetData(SQLString As String) As ADODB.Recordset

    Set GetData = mConn.Execute(SQLString)

End Function





Private Sub Class_Terminate()

    Set mConn = Nothing

End Sub



TIA




  Return to Index