Results 1 to 2 of 2

Thread: Create table and update in SQL with VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    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

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width