SQL VB6 connectivity Data access error

Status
Not open for further replies.

CyCo

In the zone
i am trying to access a SQL table from VB6 ..

i have done it many times before using MSRDC and ADODC ..

what is happening is that :

1. in MSRDC after setting up everything , when i finally set the properties of a textbox to read the values into , i select its datasource.

When i try to select datafield , the error is get is
"IM006: [microsoft] [ODBC driver manager] Driver's SQLsetattr failed"
"Data access error"

2. In ADODC , i get the same error when i do test connection....

the only reason i cd figure out is that when i login to SQL , i use
user: scott
pass: tiger
Hoststring: <SID Value during Install>

But for me the hoststring is optional .. if i put it or not, i can still use the same tables....

Pls help !!!!

P>S> the steps i had followed were ..

VB
Components - Microsoft Remote Data Control 6.0
Add the MSRDC on the form
Set : pass , username , SQL

To set Datasource name :
Admin tools - Datasources ODBC
Add - microsoft ODBC for Oracle

Datasourcename - anything
User , server (SID)

Object (text box)
datasource msrdc1
datafield --- > ERROR
 

DukeNukem

Come get Some
FIRST OF ALL WHICH DB ARE YOU TALKING ABOUT
USER/PASSWORD WHICH YOU ARE PROVIDINS IS FOR ORACLE
IF IN CASE YOU HAVE CREATED THIS USER/PASS IN SQL SERVER THAN " IAM SORRY"
-----------------------------------------------------------
i'll Explain using ADO

first make a DSN for SQL SERVER/ORACLE (WHICH EVER YOUR DB IS)
---------------------------------------------------------------
for SQLSERVER
enter the name of dsn and the server name on the first screen, username and password on the second screen
test the made dsn.
-------------------------------------------------------------------
for ORACLE
enter the name of dsn, USER NAME, server name(Oracle SID)
(THIS USER MUST HAVE CONNECT PRIV. TO DO SO)
-------------------------------------------------------------------

now
Fire Visual Basic
Make New Proj.
Choose "Microsoft Activex Data Obj 2.X" from references

Make this as global

dim conn as connection
dim ress as recordset

this on form load

set conn = new connection
conn.provider = "SQLOLEDB" 'for ORACLE use MSDAORA
conn.connectionstring = "DSN =<DSN>;USER ID = <UID>; Password = <PWD>"
conn.open

set ress = new recordset
ress.activeconnection = conn
ress.open "<YOUR QUERY GOES HERE>"



Thats it you are connected to your database

to access records use "ress!<fieldname>" (without ")
 
Status
Not open for further replies.
Top Bottom