.net - How to insert data in Asp.net page when the table has an identity column -
i'm getting error when i'm inserting data in database table identity specification.
sql
string query = "insert student values('"+txtname.text+"','"+name_image+"','"+txtage.text+"','"+txtaddress.text+"')"; error
column name or number of supplied values not match table definition.
you should in habit of always specifying explicit list of columns want insert values - way, can omit identity column , prevent error:
insert dbo.student(col1, col2, ...., coln) values(val1, val2, ...., valn) just saying insert dbo.students values(...) means have provide value every column - including identity column - cannot provide value for!
Comments
Post a Comment