このクエリはデータベースで実行されました。
select COUNT(*) from Patient_Data where DummyValue = 'Y';
104
number (104)
からこれを取得して、カウントがゼロになったときにdatabase
データベースからコードにこの番号を取得する必要があります。として保存する必要があります。asp.net with c#
disable a button
retrieve
integer
これらのコード行をc#で試しました
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("select COUNT(*) as PatientCount from Patient_Data where DummyValue = 'Y' ", cn))
{
try
{
cn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
int Patcount;
if (rdr.Read())
{
//Code Required
}
}
}
catch (Exception ex)
{
// handle errors here
}
}
}