sql语句查询出来的一个值赋 给一个控件的text属性 问题
来源:百度知道 编辑:UC知道 时间:2024/06/01 19:37:29
不怎么熟悉SQL语句 出现了几个问题 不懂 请教大家
1. 怎么将sql语句查询出来的一个值赋 给一个控件的text属性
this.labl1.text= select id from table where id='1'
2.
定义一个变量
string i
从数据库中取出数据 赋给 i
多谢大家了。。
1. 怎么将sql语句查询出来的一个值赋 给一个控件的text属性
this.labl1.text= select id from table where id='1'
2.
定义一个变量
string i
从数据库中取出数据 赋给 i
多谢大家了。。
你需要建立Connection,执行SqlCommand,才能得到结果,
this.labl1.text= select id from table where id='1' 这个东西C#的编译器可不会认.
而且select id from table where id='1'这个是个什么语句?你不如直接写this.label1.Text = "1";
你这两个问题是一个问题.Label的Text就是string
select id from table where id='1' 返回一个 数据
用STRING接一下
然后 text = string