且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从SQL表中检索记录

更新时间:2023-02-23 11:34:31

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[^]