smegghead
asked on
SQL Server & VB6
Hi,
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 ???
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(
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 ???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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 ???
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 ???
To open Access file without DSN, use this:
strConn = "Provider=Microsoft.Jet.OL EDB.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).
strConn = "Provider=Microsoft.Jet.OL
"Data Source=C:\...\JetPassword.
"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).
ASKER
Thank you...
PS. Q191754 / Q.191754 / EQ.191754 - I can't find....
PS. Q191754 / Q.191754 / EQ.191754 - I can't find....
Article ID like this are taken from the Microsoft Knowledge base (support.microsoft.com) in which you can search for exact article number.
ASKER