Insert data into SQL Server from C# code

前端 未结 7 1860
自闭症患者
自闭症患者 2021-01-06 06:59

I have a table student (id, name). Then I have one textbox, for entering the name, when click on submit button, it inserts the data into the databa

7条回答
  •  醉梦人生
    2021-01-06 07:06

    Try the following query,

    insert into student(name) values(name) 
    

    SQL Server internally auto increments the id column when u insert the data since u said it is auto increment. If it is not working, the u have to check the identity column in the db.

提交回复
热议问题