Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating sql 2000 connection to vb6

Status
Not open for further replies.

Stripes1283

Programmer
Jun 13, 2007
28
ZA
I have created the neccesary steps to connect to the server at least but now it gives me an error where
Datagrid1.Datasource= rs

it says that "Method or Datamember not found"

and it highlights the Datasource.

Please help
 
This is my current code:

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()

Set con = New ADODB.Connection
Set rs = New ADODB.Recordset

Dim sqlstr As String
Dim str As String

sqlstr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=TDFDEV;" & "Initial Catalog = FRSSA"
con.ConnectionString = sqlstr
con.Open sqlstr

str = "SELECT FltNo from tblTargetSpendPerHead where FltNo = 123"
rs.Open str, con, adOpenDynamic, adLockPessimistic, adCmdText
DataGrid1.DataSource = rs

End Sub
 
Why are you using an Access driver to connect to SQL Server?

Are you sure the connection and recordset actually connect and return something?

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
I also suggest that you read the explanation I gave you of the Jet provider, and OLE DB providers in general, in your other thread thread222-1377711. Sure looks from what you're saying here that you haven't take the trouble to read it.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top