Moojjoo Blog
THE FOLLOWING CODE IS FOR COUNTING RECORDS IN A DATABASE USING ADO.NET, C#
//string countSQL = "SELECT COUNT(userID) FROM CamelHeadCount WHERE userID =" + GetUserName();
string countSQL = "SELECT COUNT(userID) FROM CamelHeadCount WHERE userID = 'DANNELR'";
SqlConnection Conn = new SqlConnection(strConn);
SqlCommand myCommand = new SqlCommand(countSQL, Conn);
Conn.Open();
Int32 recordCount = (Int32) myCommand.ExecuteScalar();
if (recordCount > 0)
{
Response.Write("Our records indicate that you have already confirmed");
Response.End();
}
Conn.Close();
1 comment:
And the anwser is:
In the code behind:
str_emp_dept = Convert.ToString(((Department_dropdown)e.Item.FindControl("Department_dropdown2")).Selected_dept_value());
WHOOOOOOHOOOOOOO!!!!!!!!!!!!!!
Post a Comment