|
-
Nov 16th, 2000, 10:59 AM
#1
I have a database called Employee on a remote SQL server.
The database has a table called CompTime.
I need to know how I can access the data on the CompTime table using VB. I have an ODBC drive to conned to the SQL Server(called TEST) and userid: sa, password: blank.
Could someone help me with the code to connect and access the data from the database.
Thank you.
-
Nov 16th, 2000, 11:21 AM
#2
Fanatic Member
Connect to it using ADO and use the OLE DB Provider.
i.e.
Code:
Dim cn As New Connection
cn.ConnectionString = "DSN=Test;UID=sa" ' or whatever
cn.Open
Dim rs As Recordset
rs.Open Source:="SELECT * FROM CompTime", ActiveConnection:=cn
etc.
The Source:="..." syntax is named argument, so you do not have to remember the position or put in loads of commas.
Check out the Microsoft site for and ADO overview.
Hope that helps.
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 16th, 2000, 11:40 AM
#3
Fanatic Member
shuj66,
I've just seen your earlier post. As a relative newbie, you would find it much easier to use the DataEnvironment and use bound controls. Check out barrk's answer to your earlier post.
P.
Not nearly so tired now...
Haven't been around much so be gentle...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|