Dim cn As ADODB.Connection
Dim adoRS As ADODB.Recordset
keeps giving me no user defined types :confused:
Printable View
Dim cn As ADODB.Connection
Dim adoRS As ADODB.Recordset
keeps giving me no user defined types :confused:
You need to set a reference to the Microsoft ActiveX Data Objects Library X.X (where X.X is the latest version you have on your machine. I have 2.7 but some folks have 2.8).
thanks, worked.
also..
VB Code:
Private Function SQL_Connect() Set cn = New ADODB.Connection cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=<server>;PORT=3306;DATABASE=db;USER=<user>;PASSWORD=<pass>;OPTION=3;" cn.Open Set adoRS = New ADODB.Recordset End Function
i call this on form_load to connect to the database. How can i set a boolean variable to true/false depending if the connection to the databse was successful..
this way, if im doing sql statements throughout the proggy i can check if the bool variable is true first!
VB sets the boolean for you.VB Code:
If cn.State = adStateOpen Then