.net中如何把sql查询的某一个键提出来

[复制链接]
查看11 | 回复3 | 2009-8-11 09:07:07 | 显示全部楼层 |阅读模式
你方法用错了,你希望查询出一条信息里面的某一个值应该使用SqlDataReader。
string name = this.TxtId.Text.ToString();
string pass = this.TxtPassWord.Text.ToString();
SqlConnection con = new SqlConnection("Server=.;uid =Sa;pwd ='';database=Customer;");
con.Open;
string sql1 = "select * from Customer w...
回复

使用道具 举报

千问 | 2009-8-11 09:07:07 | 显示全部楼层
string name = this.TxtId.Text.ToString();
string pass = this.TxtPassWord.Text.ToString();
SqlConnection con = new SqlConnection("Server=.;uid =Sa;pwd ='';...
回复

使用道具 举报

千问 | 2009-8-11 09:07:07 | 显示全部楼层
用Dataset就可以,下面是例程: SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter a = new SqlDataAdapter("select myName, myId from mytable;",conn); DataSet s = ...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行