如何从SQL表中检索记录 [英] How to retrieve records from sql table

查看:111
本文介绍了如何从SQL表中检索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以向我发送用于从sql表中检索记录(数字)的代码(vb.net)

当我单击复选框时,记录将出现在文本框中
当我选择micle时,他的出勤记录就会消失
复选框(文章)textbox1(出席天数)textbox2(缺席天数)
谢谢

Can anyone send me the code (vb.net) for retrieve records ( numbers) from sql table

As when I click the checkbox the record will appear in the text box
When I select micle then his record for attendance will apear
Checkbox (Micle) textbox1 (attend days) textbox2( absent days )
Thank you

推荐答案

query =从table_name中选择count(*),其中user_id = user_id";
sqlcommand sql =新的sqlcommand(查询,连接);
datareader reader = sql.executescalar();
int number_of_records = reader.RowCount;



现在,如果您有一个存储d与会者的列,则可以执行以下操作:
从表名中选择列名,其中用户=用户名
query = "select count(*) from table_name where user_id = user_id";
sqlcommand sql = new sqlcommand(query, connection);
datareader reader = sql.executescalar();
int number_of_records = reader.RowCount;



now if you have a column that stores d attendace, u can do this:
select column_name from table_name where user = user_name


在此处阅读有关ADO.NET的信息,它将对您有所帮助.

看看这些:
MSDN:ADO.NET [ MSDN:使用ADO.NET访问数据 [ ^ ]

C#Station ADO.NET教程 [为初学者使用ADO.NET [
Read about ADO.NET here and it will help you.

Look at these:
MSDN: ADO.NET[^]
MSDN: Accessing Data with ADO.NET[^]

The C# Station ADO.NET Tutorial[^]
Using ADO.NET for beginners[^]


这篇关于如何从SQL表中检索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆