的连接式和断开式计划
2021-08-24 12:57:08 菏泽汽车网
关于的书籍和文章很多,在这里主要使用在我教学中给学生做演示的两个小例子,来比较的连接式和断开式,程序员一般不喜欢说教,下面就以代码说话:
连接式
SqlConnection sqlConn=new SqlConnection(\"server=.;database=pubs;
user id=sa;password=;\");
SqlCommand sqlComm=new SqlCommand(\"select * from authors\",sqlConn);
//操作在打开和断开数据库之间
en();
SqlDataReader dr=cuteReader();
while(ad())
{
for (int i=0; eldCount; i++)
{
ite(tValue(i).ToString()+\" \");
}
iteLine();
}
ose();
ose();
断开式
SqlConnection sqlConn=new SqlConnection(\"server=.;
database=pubs;user id=sa;password=;\");
SqlDataAdapter adapter=new SqlDataAdapter(\"select * from authors\",sqlConn);
//用来自动生产更新命令
SqlCommandBuilder cb=new SqlCommandBuilder(adapter);
en();
DataSet ds=new DataSet();
ll(ds);
ose();
//处理数据在打开和关闭之后
for (int i=0; bles[0].unt; i++)
{
for (int j=0; bles[0].unt; j++
{
ite(bles[0].Rows[i][j]+\" \");
}
上述6项风电资产2010年至2013年的实际发电量 iteLine();
}
//更改数据
bles[0].Rows[0][1]=\"A\";
bles[0].Rows[1].Delete();
//更新数据库
en();
date(ds);
ose();
查看本文来源
止脱生发液哪个牌子好好好黄芪颗粒和江中黄芪生脉饮哪个效果好
湖州哪家男科医院好
- 上一篇:的数据操作组件物业
- 下一篇:获取存储过程的返回值覆盖