数据库的查询分析器中写上如下代码:
create table studentname
(
id int primary key identity(1,1) not null ,
name nvarchar(500) not null
)
insert into studentname values('long')
insert into studentname values('long')
insert into studentname values('long')
insert into studentname values('long')
insert into studentname values('long')
insert into studentname values('chao')
insert into studentname values('chao')
--sql server 2012 通过。
---------------------------------------------------------------------------------------------------
以下是第一种方法:
using System.Data;
using System.Data.SqlClient;
string constr = "server=localhost;uid=sa;pwd=longshicheng;database=Student";
SqlConnection conn = new SqlConnection(cons