I am getting this error “Incorrect syntax near keyword User”
Code:
Imports System.Data.SqlClient
Public Class adduser
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddUser.Click
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Try
cn.ConnectionString = " data source = Rayon\Rayon; Initial catalog = Library; uid=sa; password = minnie"
cn.Open()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = "Insert into User (UserId, FName, MName, LName, Street1, Street2, City, Zone, ContactHome, ContactWork, ContactCell, Email, Gender) values ('" & txtuserid.Text & "', '" & txtFname.Text & "' '" & txtMname.Text & "' '" & txtLname.Text & "' '" & txtStreet1.Text & "' '" & txtStreet2.Text & "' '" & txtCity.Text & "' '" & cbZone.Text & "' '" & txtHome.Text & "' '" & txtWork.Text & "' '" & txtCell.Text & "' '" & txtEmail.Text & "' '" & cbGender.Text & "' )"
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Error while insrting record on table..." & ex.Message, "Insert Records")
Finally
cn.Close()
End Try
End Sub

