-
Mar 7th, 2013, 02:21 AM
#1
Thread Starter
New Member
[ODBC Driver Manager] Data source name not found and no default driver specified
I am trying to display oracle DB into DataGrid and facing some problem
Code:
Private Sub Command2_Click()
Dim oconn As ADOconnect
Dim rs As Recordset
Dim strSQL As String
strSQL = "SELECT * FROM ZZZJUNKPERSON"
Set oconn = New ADOconnect
Set rs = New ADODB.Recordset
oconn.Open "ODBC;DSN=SSSS;UID=SSSSS;PWD=SSSSS;DATABASE=SSSSS"
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open strSQL, oconn, , , adCmdText
Set DataGrid1.DataSource = rs
End Sub
when I compile the code I get error.
I am new to VB.
Last edited by hoho46; Mar 7th, 2013 at 04:55 AM.
-
Mar 7th, 2013, 02:31 AM
#2
Re: ERROR: method or data member not found
What is 'ADOconnect' ?
Normally you'd define a Reference to Microsoft Active Data Objects and use 'ADODB.Connection'. Also you need to initialise the RecordSet before using it in the same way you do for the connection.
Code:
Private Sub Command2_Click()
Dim oconn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM ZZZJUNKPERSON"
Set oconn = New ADODB.Connection
Set rs = New ADODB.RecordSet
oconn.Open "Provider=msdaora;ODBC;DSN=SSSS;UID=SSSSS;PWD=SSSSS;DATABASE=SSSSS"
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open strSQL, oconn, , , adCmdText
Set DataGrid1.DataSource = rs
End Sub
-
Mar 7th, 2013, 02:38 AM
#3
Thread Starter
New Member
Re: ERROR: method or data member not found
Thanks for the reply, I am new to this. I just follow some tutorial by googling.
I still get the runtime error message: ORA-12560: TNS: protocol adapter error
What is that mean?
-
Mar 7th, 2013, 02:46 AM
#4
Re: ERROR: method or data member not found
Probably that your connection string is incorrect. try
Code:
oconn.Open "Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;"
where 'MyOracleDB' is your Oracle Database,'myUsername' is your Oracle Username and 'myPassword' is your Oracle Password
-
Mar 7th, 2013, 03:03 AM
#5
Thread Starter
New Member
Re: ERROR: method or data member not found
then i got this error message. very Sorry
ORA-12154: TNS:could not resolve the connect identifier specified
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|