PDA

Click to See Complete Forum and Search --> : ODBC


smrenga
Oct 31st, 2000, 04:39 AM
Hi!

I was trying to open a SQL Server database from VB5.0.

1. Created a DSN

2. Using Opendatabase method, opened the database

3. Using Openrecordset method, i was trying to open a table in the SQL Server database

This gives an error saying,"Not a valid Stored procedure". then, i tried opening a stored procedure. But, i couldn't open a stored procedure also.

Anyone can help me to open a table(SQL Server) from VB5.0

Thanks in advance

Regards
smrenga

ShIzO
Oct 31st, 2000, 09:05 AM
are u using ADO or RDO?

in ADO:


Dim cn as new Connection
Dim rs as new Recordset

cn.open "<your connection string goes here>"

set rs = cn.Execute("<your SQL code to retrieve a recordset goes here>")

Do While Not rs.eof
.
.<here you manipulte data on "by row" basis>
.
.
rs.MoveNext
Loop



ps. you said you want to open table: you don't open table - you open connection and get the recordset from the table.


email me if you have any questions