SQL Server & VB6


I've just started looking at SQL-Server V7, I'm currently using a jet database and I'm looking to move my application over to SQLSERVER.

I've tried to be as standard as I can with my SQL statements throughout the code, i.e. not using any VB functions.

I optimistically thought that I would simply have to change the OpenDatabase command to connect to the ODBC DSN which points to the database on an SQL server. (ha ha ha)

I'm using a ODBC workspace and just using a

SET dbase=wsODBC.OpenDatabase(dsnname)

Which works fine, except that the only thing I can do with this is select statements, as soon as I try to run an update SQL statement, it say ODBC-Call failed (or something like that).

I'm just doing

delete * from [MyTable] where idx=1

surely this should work... is there any way of getting more detailed error reports from SQL ?? 'ODBC Call failed' doesn't help me much.

Another question, which I'll award points for separately (should I get a positive answer) is, can you create a database on a SQLsever remotely via VB code ???
LVL 10
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

smeggheadAuthor Commented:
Also, when I run a select statement on the database, the recordcount property is always -1. Is there a way of determining the number of records returned without 'movenext'ing and counting until the EOF is reached.
Éric MoreauSenior .Net ConsultantCommented:
Remove the * in your Delete query like this:
delete from MyTable where idx=1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
smeggheadAuthor Commented:
yeah, I know, I've started using ADO rather than DAO and it gives an error message .. blah blah blah near '*', so I whipped it out and hey presto...

I've also sorted out the -1 thing...

You can have the points, if you just answer this easy question...

Is it possible to open a JET (MS Access) database using an ADO connection without creating a DSN ???

And.. any ideas on the creating of a database remotely ???
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Éric MoreauSenior .Net ConsultantCommented:
To open Access file without DSN, use this:

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
             "Data Source=C:\...\JetPassword.MDB;" & _
             "Jet OLEDB:Database Password=MyPwd"
   MyConn.Open ConnectionString:=strConn

Take a look at article id Q191754 (where this example come from).

To create database using ADO, you need ADOX (in ADO 2.1 and higher).
smeggheadAuthor Commented:
Thank you...

PS. Q191754 / Q.191754 / EQ.191754 - I can't find....
Éric MoreauSenior .Net ConsultantCommented:
Article ID like this are taken from the Microsoft Knowledge base (support.microsoft.com) in which you can search for exact article number.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.