protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection objConn = new SqlConnection(sConn);
objConn.Open(); SqlDataAdapter oDAd =
new SqlDataAdapter(sSQL, objConn);//连接、翻开、读
DataSet ds = new DataSet();
oDAd.Fill(ds, "cj2"); oDAd.Dispose();
GridView1.DataSource = ds.Tables["cj2"]; GridView1.DataBind();}
头部 using System.Data;
using System.Data.OleDb ;Using System.Data.SqlClient; 运行 …
创立数据:
DataTable dt = new DataTable(); //数据库表的内存载体
sSQL = "create table wordDic (英语,数学, 语文)";
OleDbConnection objConn = new OleDbConnection(sConn);
objConn.Open(); OleDbDataAdapter oDAd =
new OleDbDataAdapter(sSQL, objConn);
oDAd.Fill(dt); oDAd.Dispose(); Label1.Text = "成功创立,OK";
填充数据:
DataTable dt = new DataTable(); //数据库表的内存载体
sSQL = "insert into wordDic values('80','80','80')";
OleDbConnection objConn = new OleDbConnection(sConn);
objConn.Open(); OleDbDataAdapter oDAd =
评论0
最新资源