Help! on how to use SQL server 2005 tables

benz_jie

Registered User.
Local time
Tomorrow, 06:13
Joined
Sep 14, 2006
Messages
15
hi I'm new to SqL server set-ups, my probs is on how to start using the tables in the SQL server2005 after my connection is being open, like for example:

Dim db as database
Dim rs as recordset
Dim StrSQL as string

set db=currentdb
StrSQL="Select * from tblemployees where empid='"&txtempid &"'"
set rs=db.OpenRecordset(StrsQL)

* with that line "tblemployees" is one of those table name at SQL server 2005 database name KPCdb, but my probs was i'm getting an error...So for now Im asking your help people who got enough knowledge on SQL Server2005 if you can give me some lines of program coding that would let me use or query tables in the server..

Thanks
Ben
 
I use this code in Ms Access
Dim cnn As ADODB.Connection
Dim str As String

Set cnn = New ADODB.Connection
str1 = "Provider=sqloledb;" & _
"Data Source=ServerName;" & _
"Initial Catalog=DatabaseName;" & _
"User Id=UserID;Password=Password;"

cnn.Open str

Set rst = New ADODB.Recordset
Set rst = cnn.Execute("SELECT * FROM Table")
rst1.MoveFirst
'Put field value into text box
Text1.Value = rst1.Fields("FieldName")
rst1.Close
 

Users who are viewing this thread

Back
Top Bottom