zolpo
asked on
ado data control connection string
Hi
I'm using VB6 with access97,
one of my forms contains an adodc,
can I give a connection string after the application starts instead of
putting it in the connectionString property in the properties window?
I need to do so because my connection string is created after the application start running.
I tried putting on sub Form_Load the following code:
adodc.connectionString strConn
But it didnt work.
Thanks .
I'm using VB6 with access97,
one of my forms contains an adodc,
can I give a connection string after the application starts instead of
putting it in the connectionString property in the properties window?
I need to do so because my connection string is created after the application start running.
I tried putting on sub Form_Load the following code:
adodc.connectionString strConn
But it didnt work.
Thanks .
Sorry, if you want to connect to access you will need a connection string along the lines of;
Provider=Microsoft.Jet.OLE DB.4.0;Pas sword="";D ata Source=E:\temp\eScheduling 51\Export\ DataWareho use.mdb;Pe rsist Security Info=True
the string shown in the previous note shows a connection to an ms SQL database
Provider=Microsoft.Jet.OLE
the string shown in the previous note shows a connection to an ms SQL database
I've just noticed a spelling mistake in my answer, everywhere you see ADODC should be replaced with ADODB
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is some sample code I've used.
Dim cnn3 As ADODC.Connection
Dim strCnn3 As String
Set cnn3 = New ADODC.Connection
strCnn3 = "Provider=SQLOLEDB.1;Persi
cnn3.Open strCnn3
' then set the chassis serial number
If strYear = "2003" Then
cnn3.Execute "UPDATE VBLD_CHASSIS_SERIAL SET CHASSIS_SERIAL = (SELECT '1' + [YEAR] + RIGHT(STR(SEQUENCE), 4) -1 From VBLD_CHASSIS_SERIAL WHERE ORDER_NO = '" & txtOrder & "') WHERE ORDER_NO = '" & txtOrder & "'"
Else
cnn3.Execute "UPDATE VBLD_CHASSIS_SERIAL SET CHASSIS_SERIAL = (SELECT '1' + [YEAR] + RIGHT(STR(SEQUENCE), 4) From VBLD_CHASSIS_SERIAL WHERE ORDER_NO = '" & txtOrder & "') WHERE ORDER_NO = '" & txtOrder & "'"
End If