I am new to programming and .net - Trying to setup a simple page to submit email, name and comments to a sql database into a table called "GuestList". Input comming from three text boxes. No error until I try to submit the info. Here is the code on the submit button. I am trying to do this w/o a datagrid. Any suggestions welcome - THANKS!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnString As String = "server='snapghiis01'; user id='exit3'; password='exit3user'; Database='Exit3'"
Dim sqlConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(ConnString)
Dim sqlString As StringBuilder = New StringBuilder(400)
Dim sqlCommand As System.Data.SqlClient.SqlCommand
sqlConn.Open()
sqlString.Append("INSERT INTO GuestList(Email,Name,Comments)VALUES")
sqlString.Append("?" & TBEmail.Text & "?,")
sqlString.Append("?" & TBName.Text & "?,")
sqlString.Append("?" & TBComments.Text & "?)")
sqlCommand = New System.Data.SqlClient.SqlCommand(sqlString.ToString(), sqlConn)
sqlCommand.ExecuteNonQuery()
sqlConn.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnString As String = "server='snapghiis01'; user id='exit3'; password='exit3user'; Database='Exit3'"
Dim sqlConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(ConnString)
Dim sqlString As StringBuilder = New StringBuilder(400)
Dim sqlCommand As System.Data.SqlClient.SqlCommand
sqlConn.Open()
sqlString.Append("INSERT INTO GuestList(Email,Name,Comments)VALUES")
sqlString.Append("?" & TBEmail.Text & "?,")
sqlString.Append("?" & TBName.Text & "?,")
sqlString.Append("?" & TBComments.Text & "?)")
sqlCommand = New System.Data.SqlClient.SqlCommand(sqlString.ToString(), sqlConn)
sqlCommand.ExecuteNonQuery()
sqlConn.Close()
End Sub