Unanswered: Updating and Executing file using SQL Server 2000 and Visual Basic
I am trying to update the local database by running a txt file with several DML statement e.g. delete, update, and insert. I need to use Visual Basic to connect to the database and execute the script (or the contents of the script). How do I go about it?
I have put together this but I need to know how to use the 'strsql' and 'cmDB.Execute' to update and execute the file. Thanks for all your help.
' Update the (local) xxxx Database by running "xxx_UpdateDB.txt"
Private Sub cmdUpdateLocalxxx_Click()
Dim cnConnection As ADODB.Connection
Dim cmDB As ADODB.Command
Set cnConnection = CreateObject("ADODB.Connection")
Set cmDB = New ADODB.Command
cnConnection.ConnectionString = "Provider=sqloledb;Data Source='(local)';Initial Catalog='xxx';User Id='xx'; password='xxxxxx"
' strsql = ""
'Dim cnConnection As ADODB.Connection
cmDB.CommandType = adCmdFile