【发布时间】:2018-07-25 08:29:43
【问题描述】:
所以我已经设置了我的数据库连接并且它确实连接了。
现在我想检查表中的每一行 isactivated 列是 0 还是 1 因为它是一个位,但我不知道该怎么做。
我会执行查询吗?我会将所有行存储在一个列表中然后检查吗?
using (var connection = new SqlConnection(cb.ConnectionString))
{
try
{
connection.Open();
if (connection.State == ConnectionState.Open)
{
Console.WriteLine("Connected!");
}
else
{
Console.WriteLine("Failed..");
}
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
【问题讨论】:
-
检查你的行,然后用它们做什么?
-
@TheGeneral
I want to check each row in my table wether the column isactivated is either 0 or 1 because it's a bit -
哪个没有回答我的问题,你想统计它们吗,你想过滤我的这个字段,你想只检查是否存在
-
这是迄今为止任何初学者教程都可以回答的最初学者的问题。没有人天生就具备您需要学习的所有知识。