PDA

Click to See Complete Forum and Search --> : ADO newbie


Patrice Bourdages
Jun 19th, 2000, 01:54 AM
I'm stuck.

I need to convert a Clipper (xBASE compiler) with .dbf files into a VB application connected to a SQL Server 7.0.

I'm totaly lost with the ADO stuff... Is there a simple explanation or notes somewhere that I could read in order to better understand what is going on...

Here's the code I need to convert (example):

function open_table()
use temp new exclusive alias Temp
use tablsigm new exclusive alias Sigma
index on TableName to TablSigm
use layas400 new exclusive alias LayoutAS400
zap
use dictionr new exclusive alias Dictionnary
index on FieldName to dictionr
return(.t.)

How do I "open" all those SQL table (they are transfered on the SQL server as of now) from within VB using the ADO syntax...

I'll have some more question... I'll keep them for later...

Sincerely yours,

Patrice :-)

JHausmann
Jun 19th, 2000, 03:34 AM
Can you explain what each line in the function does? Or better yet, post what you want the function to do...

Some things will have no equivalent in SQL 7.0.

Patrice Bourdages
Jun 20th, 2000, 12:45 AM
I need to open several tables at once and do some .Find and some update/create records in the table Dictionnary.

The fact of opening those tables simultanously is to loop, find and grab whatever information possible to update the table Dictionnary.

Can we have numerous connection opened at the same time (hope so). Otherwise, I'll end up swetting a lot...

My IS manager sent me on VB courses so that I could upgrade my CA-Clipper apps into VB.

Am i clear enough ??? Do you understand the purpuse of what I'm trying to do ?

Thanks for your help.

Sincerely, Patrice

Negative0
Jun 20th, 2000, 01:05 AM
The way that I would approach this would be to use the Connection to connect to the database and multiple recordsets to get to the tables.

GLOBAL DB as New Connection
Sub Connect()

DB.Open "dsn=YourDSN;uid=user;pwd=pass" 'ONLY DO THIS ONCE

End Sub

Sub OpenTables()
Dim rs1 as New Recordset
Dim rs2 as New Recordset

rs1.open "SELECT * FROM tbl1",DB,adOpenForwardOnly,adOpenReadOnly
rs2.open "SELECT * FROM tbl2",DB,adOpenForwardOnly,adOpenReadOnly

if rs1.eof = false
if rs2.eof = false
'DO your work here
end if
end if

End Sub

Hope this helps

Patrice Bourdages
Jun 20th, 2000, 09:58 PM
Sounds great...

Now, let's say I have an DataEnvironnement and a connection defined using ADO instead of a DSN, would it be the kind of syntax ?

Here's the DataEnvironment data and connection:

cnDictionnary:

Provider=SQLOLEDB.1;
Integrated Security=SSPI;
Persist Security Info=False;
Initial Catalog=Act1;
Data Source=SQLSRV

Would I simply go:

cnDictionnary.Open instead of the connect string you provided me with ?

Negative0
Jun 20th, 2000, 11:45 PM
Yeah, I think that should work.

Patrice Bourdages
Jun 21st, 2000, 12:37 AM
Thanks a bunch Negative0.

Appreciate it a lot.

Sincerely,

Patirce :-)