vb.net project connecting to sql server not working

  • i have visual studio.net on my computer and am writing a program (windows application) and would like to connect to the database that is on the same machine. The database is MSDE 2000. I use web data administrator to use the database.

    When I go to connect to the DB through my program, the program just hangs forever. Please help, I am so confused. There seems to be mutliple ways to connect with different connection strings.

    this is what i am using to connect-----

    Imports

    System.Data.SqlClient

    Dim strInfo As String 'string used to connect to DB

    Dim conn As SqlConnection

    Dim cmd As SqlCommand 'sql command statement

    strInfo = "DRIVER={SQL Server};SERVER=(local);DATABASE=family;User ID=Theresa Kadlubowski;PWD=23purple"

    conn =

    New SqlConnection

    conn.ConnectionString = strInfo

    conn.Open()

    cmd =

    New SqlCommand

    cmd.CommandText = "Insert into members (fname, lname, dob, email) values(v_fname, v_lname, v_dob, v_email)"

    'execute sql statement

    cmd.ExecuteNonQuery()

    conn.Close()

     

    signed,

    confused

  • Looks like you have a space in the SQL Login name: ID=Theresa Kadlubowski

    Try: ID=[Theresa Kadlubowski]

    Or recreate the Login without a space, see rules for identifiers in SQL Server books online (BOL).

    Andy

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply