Binding Textbox data in SQLDatabase

ThomasM

Member
Joined
Apr 5, 2006
Messages
17
Programming Experience
Beginner
Any help would be greatly appreciated:
First I am VERY new to VS. I have had some VB programming experience in the past but I am very much a novice so I truly apologize in advance if this question is elementary.
I have created a new "Web Form" with Many Textbox fields that allow the users to input information into it. I would like to populate this information into a SQLdata base with a Button_Click. I have successfully created a SQL Database/Connection within my App .....App_Data/CustomerInfo.mdf. There is currently NO data in the database but I have setup a table (CustomerTable) with associated catagories.
Each one represents a Textbox "WorkSheetNum, DealerShipName, FirstName, MiddleName,LastName, Address, City, State, Zip"
Here is what I have so far but I am uncertain how to pull the data from the Textboxes?


Protected Sub bCreateCust_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bCreateCust.Click
Dim ra As Integer
Dim myConnection As SqlConnection = Nothing
Dim myCommand As SqlCommand = Nothing
Dim sql, ConnectionString As String

ConnectionString =
"Integrated Security=SSPI;" + "Initial Catalog=CustomerInfo;" + "Data Source=localhost;"
myConnection.ConnectionString = ConnectionString
myConnection.Open()
sql =
"INSERT INTO CustomerTable(WorkSheetNum, DealerShipName, FirstName, MiddleName,LastName, Address, City, State, Zip) " + "VALUES () "
myCommand = New SqlCommand(sql, myConnection)
ra = myCommand.ExecuteNonQuery()
Response.Write("Records Inserted" & ra)
myConnection.Close()
End Sub
Any help would again be greatly appreciated.
 
welcome to the forums, i moved your topic here because you're question is directly about accessing data in VB
 
Back
Top