
VB 4.0 and SQL Server problem
I hope somebody can HELP me with this strange problem I'm having
with VB4 and SQLServer. BTW... everything worked AOK with VB3.
The first example accesses the SQL server database directly,
whereas the second example accesses the same SQL server data files
via an Access (MDB) attached files database. In the first example,
I can execute DELETE FROM but I am unable to INSERT INTO. In the
second example, I am unable to DELETE FROM but I can execute an
INSERT INTO. This problem has me stumped, did MS change the rules?
'FIRST EXAMPLE
'=============
Set dbSQL = OpenDatabase("", False, False, "ODBC;DSN=x;UID=xx;PWD=xxx")
'This works OK...
dbSQL.Execute "DELETE FROM x.xx.invoice", dbSQLPassThrough
'This does NOT work...
sSQL = "INSERT INTO x.xx.invoice "
sSQL = sSQL + sStuffNotShown + "VALUES (" + sMoreStuffNotShown + ")"
dbSQL.Execute sSQL, dbSQLPassThrough
'SECOND EXAMPLE
'==============
Set dbMDB = OpenDatabase("Attach.MDB", True, False)
'This does NOT work...
dbMDB.Execute "DELETE FROM invoice", dbFailOnError
'This works OK...
sSQL = "INSERT INTO invoice "
sSQL = sSQL + sStuffNotShown + "VALUES (" + sMoreStuffNotShown + ")"
dbMDB.Execute sSQL, dbFailOnError
Tried everything to no avail. If anyone can HELP... thanks in advance!!!