I'm trying to store a data from the checkbox. when i checked on NSO Birth Certificate it has to be stored into my mssql server.

here is my code

If nso.Checked = True Then

strsql = "insert into student info(Requirements) values ('" & nso.Checked & "')"
Dim sqlcmd As New SqlClient.SqlCommand 'opens the db
sqlcmd.CommandText = strsql
sqlcmd.Connection = sqlconn
sqlcmd.ExecuteNonQuery()

End If

But when i check on the NSO Birth Certificate the error says SqlException was unhandled. Incorrect syntax near 'info'.

It looks like "student info" is two words. You either have to enclode the table name in square brackets to indicate you are doing something weird or rename the table to something like student_info or studentInfo so that it is a single word. The second option (single word) is the recommended one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.