110,528
社区成员
发帖
与我相关
我的任务
分享
private void Form1_Load(object sender, EventArgs e)
{
string strcon = @"server=.\sqlexpress;uid=sa;pwd=;database=demo";
string queryString1 = "create table tbtest";
queryString1 += " (testid int primary key identity(1,1) ,";
queryString1 += " testcount int not null);";
queryString1 += " insert into tbtest(testcount) values(30) ";
SqlConnection MyConnection1 = new SqlConnection(strcon);
SqlCommand MyCommand1 = new SqlCommand(queryString1, MyConnection1);
MyConnection1.Open();
MyCommand1.ExecuteNonQuery();
MyConnection1.Close();
}