Don't do it like that!
Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead. Your problem will magically disappear at the same time!
And
always list your column names when inserting records!
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand com = new SqlCommand("INSERT INTO myTable (myColumn1) VALUES (@C1)", con))
{
com.Parameters.AddWithValue("@C1", strNm);
com.ExecuteNonQuery();
}
}
Using con As New SqlConnection(strConnect)
con.Open()
Using com As New SqlCommand("INSERT INTO myTable (myColumn1) VALUES (@C1)", con)
com.Parameters.AddWithValue("@C1", strNm)
com.ExecuteNonQuery()
End Using
End Using