i am having an sql query in catch block. the code is:
Dim str_exception As String = ex.Message
Dim sql5 As String = "insert into table_data(type,description) values('ERROR'," + str_exception + ")"
Dim cmd_sql5 As New SqlCommand(sql5, connection)
cmd_sql5.ExecuteScalar()
it throws an exception at cmd_sql5.ExecuteScalar(). the exception is - incorrect syntax near 'records' . i tried adding single quotes like ' incorrect syntax near 'records' .' .but still it is giving me the same error. I think it is because of the quotes near records. this exception is thrown somewhere else in the code and then it comes to cath block. i want to save the exception in the database.
how can i get rid of this error?