این مثال دم دستی هست:
public int A()
{
string stmt = "SELECT COUNT(*) FROM dbo.tablename";
int count = 0;using(SqlCoection thisCoection = new SqlCoection("Data Source=DATASOURCE"))
{
using(SqlCommand cmdCount = new SqlCommand(stmt, thisCoection))
{
thisCoection.Open();
count = (int)cmdCount.ExecuteScalar();
}
}
retu count;
}
برچسب:
نویسنده: محمد رضا جوادیان