ADO connection-recorset problems

pacg

Registered User.
Local time
Today, 11:44
Joined
Aug 27, 2004
Messages
25
Hi

I'm not a newby in programing/code but in Access-SqlServer i am.
I have all my code (and works fine) in DAO but with a connection to a mdb db.
Now i've already passed to sqlserver and need to put my code to DAO. Problems!!

I can't establish a connection into my db.
I have:
1. A DSN called DSNName;
2. A front-end app (.mde) with all my table connection;
3. My DB SQL is named SQLDataB;
4. My username and password are the same : ccdruser.

I need to create a connection ADODB, a recordset to update some records.

I have several problems reading the sintaxe.
Help
 
Code:
Dim Conn as new ADODB.Connection

Code:
'DSN 
Conn.Open "DSN=mySystemDSN;" & _ 
           "Uid=myUsername;" & _ 
           "Pwd=myPassword"

Code:
 'File DSN 
Conn.Open "FILEDSN=c:\somepath\mydb.dsn;" & _ 
           "Uid=myUsername;" & _
           "Pwd=myPassword"

And then for the recordset you do this

Code:
Dim rs As New ADODB.Recordset
rs = New ADODB.Recordset
		rs.Open("Select * from MyTable where MyStringField = " & Chr(34) & MyStringCriteria & Chr(34), Conn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)


Hope that helps...
 
Last edited:
It helped! Thanks.

Tell me 3 things:
1. Why do you use the NEW?
2. In the SQL string, how can i use the Me.Recordset (my form is based on a query that i whant to use)?

3. What the hell is the "Provider" ?

Newby stuff about SQL server ...

p.s. Very good rate
 

Users who are viewing this thread

Back
Top Bottom