I have Used following code to Insert Values in the table:
<%@ Import Namespace ="System.Data" %>
<%@ Import Namespace ="System.Data.SqlClient" %>
<script runat ="server" >
Sub Create(ByVal obj As Object, ByVal e As EventArgs)
Dim ConnString As String
Dim SQLstr As String
ConnString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ERL.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
SQLstr = "INSERT INTO User(FName,LName,Gender,Bran_ID,Loc_ID,Dept_ID,Join_Dt, UserType_ID,User_ID,password,EmailID) VALUES(@txtFirstName,@txtLastName, @lstGender, @lstBranName, @lstLocName, @lstDeptName, @lstJnYear, @lstUserType, @txtUserID, @Pass1, @txtEmail)"
Dim SQLConn As New SqlConnection(ConnString)
Dim SQLCmd As New SqlCommand(SQLstr, SQLConn)
SQLConn.ConnectionString = ConnString
SQLConn.Open()
SQLCmd.Connection = SQLConn
SQLCmd.CommandText = SQLstr
SQLCmd.ExecuteNonQuery() //Here Visual Studio 2005 is giving error as "Incorrect syntax near the keyword 'User'"
SQLConn.Close()
End Sub
</script>
Pls Help......??