第七章任务一
实验目的:网页和SQL Server数据库建立连接
实验要求:
Server数据库建立连接
实验步骤:
第一步:建立个数据库
第二步:连接起来
第三步:编写处理代码
实验结果:
详细代码:
using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
public partial class _Default :
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection SunCon = new SqlConnection("Data Source=djsw43;Initial Catalog=学生管理;Integrated Security=True");
();
string StuSQL;
StuSQL = "INSERT INTO 学生(学号,姓名,性别,籍贯,班级,电话)";
StuSQL = StuSQL + "VALUES('"+ + "','" + ;
StuSQL = StuSQL + "','" + + "','" + ;
StuSQL = StuSQL + "','" + + "','" + + "')";
mand StuIns = new mand(StuSQL , SunCon);
();
();
}
protected void Button2_Click(object sender, EventArgs e)
{
("");
}
protected void Button3_Click(object sender, EventArgs e)
{
("");
}
}
代码:
using System;
us
ADO连接数据库实验报告 来自淘豆网www.taodocs.com转载请标明出处.