I think I need an extra pair of eyes - or two - to tell me what I'm missing.
Using VB6, ADO 2.5 and Access '03, I've created a small program to retrieve/update data. However, it's not retrieving!
Basically, the process is:
The problem: rsTrain.BOF and rsTrain.EOF is always true. I can copy/paste cmTrain.CommandText into a query in the Access database, and it returns exactly the record(s) I expect to see.
After cnTrain.Open is executed, cnTrain.State=1 so I'm sure it's connected.
This is a process I use daily at work, (against DB2 and SQL Server databases), so I'm sure it should work.
I figure there's got to be some simple little thing I'm overlooking. If your eyes spot it, please let me know!
Using VB6, ADO 2.5 and Access '03, I've created a small program to retrieve/update data. However, it's not retrieving!
Basically, the process is:
Code:
' in declarations: -----------------------------
Global cmdSQL As String
Global cnTrain As ADODB.Connection
Global cmTrain As ADODB.Command
Global rsTrain As ADODB.Recordset
' at AppInit: ----------------------------------
dbName = App.Path + "\LogIn.mdb"
Set cnTrain = New ADODB.Connection
cnTrain.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" + _
"Data Source=" + dbName + ";"
cnTrain.Open
Set cmTrain = New ADODB.Command
cmTrain.ActiveConnection = cnTrain
Set rsTrain = New ADODB.Recordset
' at user input: -------------------------------
cmdSQL = "select * from TrainFile where " + _
"SSN like '*" + txtSSN4 + "' and " + _
"LName like '*" + txtLName + "*'"
cmTrain.CommandType = adCmdText
cmTrain.CommandText = cmdSQL
rsTrain.Open cmTrain
The problem: rsTrain.BOF and rsTrain.EOF is always true. I can copy/paste cmTrain.CommandText into a query in the Access database, and it returns exactly the record(s) I expect to see.
After cnTrain.Open is executed, cnTrain.State=1 so I'm sure it's connected.
This is a process I use daily at work, (against DB2 and SQL Server databases), so I'm sure it should work.
I figure there's got to be some simple little thing I'm overlooking. If your eyes spot it, please let me know!