I am having a problem with an INSERT statement from Visual Studio actually inserting records into the table
The statement is:
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "INSERT Document (CompanyName) VALUES ('Code Test SUCCESS')"
cmd.Connection = sqlConnection1
sqlConnection1.Open()
cmd.ExecuteNonQuery()
sqlConnection1.Close()
The problem I think is with:
"INSERT Document (CompanyName) VALUES ('Code Test SUCCESS')"
In the Document table there are only two columns:
DocumentID(Primary Key, auto incrementing)CompanyName
The application runs fine doesn't throw any errors but the data will not appear as a new record.
Many thanks in advance.
EDIT: The connection String is
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\PostTracker.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True
INTOis optional - not required