Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ADODB to Connect to a ODBC Datasource.

Status
Not open for further replies.

wmd3

Programmer
Jan 22, 2002
37
US
I'm not sure if this is a VB problem, but I was hoping someone here could help me.

I'm trying to connect to a Remedy (a CRM product) Database.

It has it's own ODBC Datasource. I can connect to it successfully, but when I try to retrieve information (SELECT ...) I get the following error: "[ISAM]No Data Found."

I have also connected successfully to the ODBC Datasource using VB's VisData AddIn, and I can view all the data.

But, why can't I get data into my program?

Any idea's would be great!

Thanks in advance.
- Bill
 
Hi Bill,
first you must have VB Profesional
then a reference in your projekt to
MS activex Data objects e.g. 2.5 library

Code:
Public conn As ADODB.Connection
Public adors As ADODB.Recordset
conn.ConnectionString = "Driver=your ODBC driver;Server=YourDBserver;" & _
"Database=;Uid=user;Pwd=pass"
conn.Open
Set adors = New ADODB.Recordset
adors.CursorType = adOpenDynamic
adors.LockType = adLockPessimistic
adors.Open "yourtable", conn, , , adCmdTable

here your code

adors.close
conn.close


hope that helps

Bastel
 
Thanks, but I know all this.

I do it and I get the error "[ISAM]No Data Found." when I try to Open the Recordset. :(

Any ideas?

- Bill
 
Post your code. Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Here is the code that I get the error on.

------------------------------------------

Public Sub Test()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cn = New ADODB.Connection

cn.Open "Provider=MSDASQL.1" _
& ";Persist Security Info=True" _
& ";Data Source=Remedy ODBC Data Source" _
& ";User ID=USERNAME" _
& ";Password=PASSWORD"

Set rs = cn.Execute("SELECT * FROM [CCUS-Help Desk]")

End Sub

----------------------------------

I get the error when I open the Recordset (both rs.Open and cn.Execute): "[ISAM]No Data Found."

-Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top