VWD 2008 Express. Visual Basic. SQL Server 2005.
I have a SqlDataSource that is tied to a SQL table. The first field in the table is the primary key and is an integer data type. I find that if I use a FormView to insert a new record into this table (or any other table), that the formview seems to handle providing or setting the proper value for the primary key (which is just an incremented value), and I do not have to worry about providing it. However, when I try to insert a record using the SQLDataSource.Insert command, I get any error because I do not provide a value for the primary key. How can I do the insert and have the system automatically provide the proper value for the primary key (as it does when I use a formview to insert a record)? The code I am now using is as follows. The primary key name is "nTID."
'Now writ ...
Go to the complete details ...