Hi all,
I have an ADODC control, namely ADODCTest. I need to connect it to the Oracle database using MS OLE DB Provider for Oracle. However, i would like to have the flexibility of changing the properties of ADODC - Server Name, User Name and Password using the input from a form. That means, there should be some codes that can overide the default values as entered for the ADODC control properties.
I tried to do the do the following in my Form1:
**********************************************
Public ServerName As String
Public UserName As String
Public Password As String
Public ConnStr As String
Private Sub cmdChange_Click()
ServerName = txtServerName.Text
UserName = txtUserName.Text
Password = txtPassword.Text
ConnStr = "Provider=MSDAORA.1;Password=" & Password & ";User ID=" & UserName & ";Data Source=" & ServerName & ";Persist Security Info=True"
With DBConn
.ConnectionString = ConnStr
.CursorLocation = adUseClient
.Open
End With
Load Form2
Form2.Show
Unload Form1
End Sub
**********************************************
In my Form2, i did the following :
**********************************************
Private Sub Form_Load()
AdodcTest.ConnectionString = ConStr
AdodcTest.UserName = UserName
AdodcTest.Password = Password
End Sub
**********************************************
When the application runs, it gives the following message :
ORA-00942: table or view does not exist.
This implies that the new ADODC Properties values are not overridden by the new input values from the form.
I tried to leave all the ADODC properties blank, but it gives me the following error whenever Form2 is loaded:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver spesified.
Is there any example on how i can use the ADODC without being tied up to the control properties? Thanks in advance.
I have an ADODC control, namely ADODCTest. I need to connect it to the Oracle database using MS OLE DB Provider for Oracle. However, i would like to have the flexibility of changing the properties of ADODC - Server Name, User Name and Password using the input from a form. That means, there should be some codes that can overide the default values as entered for the ADODC control properties.
I tried to do the do the following in my Form1:
**********************************************
Public ServerName As String
Public UserName As String
Public Password As String
Public ConnStr As String
Private Sub cmdChange_Click()
ServerName = txtServerName.Text
UserName = txtUserName.Text
Password = txtPassword.Text
ConnStr = "Provider=MSDAORA.1;Password=" & Password & ";User ID=" & UserName & ";Data Source=" & ServerName & ";Persist Security Info=True"
With DBConn
.ConnectionString = ConnStr
.CursorLocation = adUseClient
.Open
End With
Load Form2
Form2.Show
Unload Form1
End Sub
**********************************************
In my Form2, i did the following :
**********************************************
Private Sub Form_Load()
AdodcTest.ConnectionString = ConStr
AdodcTest.UserName = UserName
AdodcTest.Password = Password
End Sub
**********************************************
When the application runs, it gives the following message :
ORA-00942: table or view does not exist.
This implies that the new ADODC Properties values are not overridden by the new input values from the form.
I tried to leave all the ADODC properties blank, but it gives me the following error whenever Form2 is loaded:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver spesified.
Is there any example on how i can use the ADODC without being tied up to the control properties? Thanks in advance.