Create table and update in SQL with VB
Hi, i am trying to update a table using a VB script, i can get it to write to a tx file fine but not a SQL DB, i have tried getting the script to create a table to but that doesn't work! any ideas please guys?
################################################################
Dim objConnection, servername, databasename, username, password
servername = "Server"
databasename = "DB"
username = "user"
password = "password"
Sub CreateDatabase
objConnection.Create _
"Provider=SQLOLEDB;Data Source=" & servername & ";" & _
"Trusted_Connection=Yes;Initial Catalog=" & databasename & ";" & _
"User ID=" & username & ";Password=" & password & ";"
objConnection.Execute "CREATE TABLE Testtable(" & _
"Year TEXT(4), " & _
"Month TEXT(9), " & _
"Day TEXT(2), " & _
"Time TEXT(25), " & _
"UserName TEXT(50))"
End Sub
Re: Create table and update in SQL with VB
Please do not post multiple threads for the same question (original thread was moved here).
Thread closed.