it looks like there really is a problem with my insert. QuizID is an identity column that increments automatically so I'm uploading a table in this style:
with item(1) in that table object being null because our instructor said "never try to set an identity field, the database will do it for you" Well the database is being an ass today because it says "cannot inser the value NULL into column 'QuizID', table [longfilename I'm not typing]; column does not allow nulls. INSERT fails. The statement has been terminated.VB Code:
strSQL = "INSERT INTO tblQuiz(Description,QuizCreated) VALUES (@Description, @QuizCreated)" Adapter.InsertCommand = New SqlClient.SqlCommand(strSQL, Connection) Adapter.InsertCommand.CommandType = CommandType.Text Adapter.InsertCommand.Parameters.Add("@Description", SqlDbType.NVarChar, 50, "Description").SourceVersion = DataRowVersion.Current Adapter.InsertCommand.Parameters.Add("@QuizCreated", SqlDbType.DateTime, 8, "QuizCreated").SourceVersion = DataRowVersion.Current Adapter.Update(tblQuiz)
So how exactly do I get this table added to the table in the database then?





Reply With Quote