
Syntax for VB6.0 to access SQL Server 6.5
I have written code in VB4.0 (16bit) to SQLServer 6.5 using a 16bit
ODBC DSN and I have no problem. I have used the same code for VB6.0
and a 32-bit DSN to SQLServer 6.5 and the update changes 0 records. I
can take the SQL statement to ISQL and it will perform the update. Am
I missing anything going from 16-bit VB to 32-bit VB? I took the same
code to my old VB4.0 16-bit program and it will update the database
with a 16-bit ODBC. I developed it using Access 97 and am now ready
to put it in production mode on SQL Server, So I know that the code
works. My problem exists I belive in the ODBC connection or any code
change that VB6.0 requires that worked in VB4.0. Any help is
appreciated!!!
The following is used to connect from vb6.0 to sql server and open the
database:
Connect$ = "ODBC;DSN=SWASTE;UID=SQLUSER;PWD=;"
Set DB = OpenDatabase("", False, False, Connect$)
The following is my updating code to the database:
sql = "update table set field1 = 'change' where pkeyfield = 234"
Set MyWorkSpace = Workspaces(0)
MyWorkSpace.BeginTrans
DB.Execute SQL, dbFailOnError
results = DB.RecordsAffected
If results > 0 Then
MyWorkSpace.CommitTrans
dbsuccess = True
Else
MyWorkSpace.Rollback
dbsuccess = False
End
* Sent from RemarQ http://www.*-*-*.com/ The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!