Results 1 to 2 of 2

Thread: Databinding Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    68

    Databinding Question

    I have two text boxes that are bound to a dataset, there is also a Sqlconnection, SqlDataadapter in use. VB.Net generated the Insert, Update and Delete statements for the dataset but I cant figure out how to get the new data out of the textboxes and into the database. This is the code that was generated by Visual Studio. Thanks for the help.

    'SqlInsertCommand1
    '
    Me.SqlInsertCommand1.CommandText = "INSERT INTO dbo.Users(UserName, UserPassword) VALUES (@UserName, @UserPassword); " & _
    "SELECT UserName, UserPassword FROM dbo.Users WHERE (UserName = @UserName)"
    Me.SqlInsertCommand1.Connection = Me.SqlConnection1
    Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UserName", System.Data.SqlDbType.VarChar, 20, "UserName"))
    Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UserPassword", System.Data.SqlDbType.VarChar, 20, "UserPassword"))

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    I never use bound controls, but wouldn't you just apply the values to the SqlCommand? Something like:
    VB Code:
    1. With SqlInsertCommand1.Parameters
    2.     .Add(New SqlParameter("@IPAddress", SqlDbType.NVarChar))
    3.     .Parameters("@IPAddress").Value = sYour_IP_Variable_Here
    4. End With
    ~Peter


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