由于初学所以运用上比较生疏请求各位指导 在此万分感谢
解决方案 »
- 求助怎么添加鼠标移动事件延时
- 两种创建资源文件resources的方法 的区别
- 求教 LINQ 的使用方式
- 请给小妹解释下这段代码的错误“{"集合已修改;枚举操作可能不会执行。" }”
- 怎样利用VS2005开发word的工具条?
- 请问这样的系统用C#可以实现吗?若可以的话,难度有多大?(关于流媒体视频的)
- sql2000和C#
- --->Oracle数据库脚本问题,在SQL PLUS中可以,使用OracleCommand执行就出错,<---
- 如何获取组合框的下拉滚动条,我是想重新绘制滚动条。
- RichTextBoxt中的图片是什么格式(没分了不好意思)
- NetworkStream.BeginWrite 后,如何取消
- 论坛小问题。。。急!!
textBox2.Text = db.foodname;
textBox2.ReadOnly = true;
if (treeView1.SelectedNode.Level > 1)
{
SqlConnection con = db.qq();
con.Open();
string sql="select id,foodprice from tb_food where foodname='"+db.foodname+"'";
我需要把查询出来的 id,foodprice输出在两个文本框控件里面;我不知道用什么语句了;
textBox2.Text = db.foodname;
textBox2.ReadOnly = true;
if (treeView1.SelectedNode.Level > 1)
{
SqlConnection con = db.qq();
con.Open();
string sql="select id,foodprice from tb_food where foodname='"+db.foodname+"'";
我需要把查询出来的 id,foodprice输出在两个文本框控件里面;我不知道用什么语句了;
string sql = "select id,foodprice from tb_food where foodname='" + db.foodname + "'";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader dr= cmd.ExecuteReader();
if (dr.Read())
{
textbox1.Text = dr[0];
textbox2.Text = dr[1];
}
db.foodname=treeView1.SelectedNode.Text;
textBox2.Text = db.foodname;
textBox2.ReadOnly = true;
if (treeView1.SelectedNode.Level > 1)
{
SqlConnection con = db.qq();
con.Open();
string sql="select id,foodprice from tb_food where foodname='"+db.foodname+"'";
SqlCommand com = new SqlCommand(sql, con);
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr[0].ToString();
textBox3.Text = dr[1].ToString();
}
还是没法显示
textBox3.Text = dr[1].ToString();
改成
textBox1.Text = dr["id"].ToString();
textBox3.Text = dr["foodprice "].ToString();
还是没有数据的话,你调试看看
textBox2.Text = db.foodname;
textBox2.ReadOnly = true;
if (treeView1.SelectedNode.Level > 1)
{
SqlConnection con = db.qq();
con.Open();
string sql="select id,foodprice from tb_food where foodname='"+db.foodname+"'";
SqlCommand com = new SqlCommand(sql, con);
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr["id"].ToString();
textBox3.Text = dr["foodprice"].ToString();
}
}
{
DataSet ds = new DataSet();
cmd = new OleDbCommand("select * from tiezineirong where Tname = '楼主是个好人'", conn);
da = new OleDbDataAdapter(cmd);
da.Fill(ds, "tiezineirong");
return ds;
} public OleDbDataReader reader(string sql)
{
OleDbDataReader reader = null;
string command = "";
cmd = new OleDbCommand(command, conn);
cmd.CommandText = sql;
reader = cmd.ExecuteReader();
return reader;
}读取
OleDbDataReader reader = new kyo().reader(sql);
if (reader.Read())
{
label1.Visible = true;
string a = "学号:";
a += reader["Sno"].ToString(); //Mark reader读取方法1
a += "\n姓名:";
a += reader.GetString(1); // Mark reader 读取方法二
a += "\n性别:";
a += reader.GetString(2);
a += "\n年龄:";
a += reader.GetValue(3);
a += "\n院系:";
a += reader.GetString(4);
a += "\n年级:";
a += reader.GetString(5);
a += "级\n专业:";
a += reader.GetString(6);
a += "\n";
// a += reader.GetValue (7);
// a += "\n";
name = reader["Sname"].ToString();
label1.Text = a;
// textBox1.Text = a;
//MessageBox.Show(a);
}
else
{
MessageBox.Show("无该数据");
}
string sql;
sql = string.Format("select * from student where Sno = '{0}'", this.id);
#region // DateGridView 使用方法
DataSet ds = new dbc.conndbc().login_DD(sql);
if (ds.Tables[0].Rows.Count > 0)
{
dataGridView1.DataSource = ds.Tables[0];
}