How would I change my syntax below to return an Int instead of a data table. I dont need a datatable its just one value that will be returned in the query. New to this whole data access thing. Thanks for your help.
public DataTable GetMemberID(string guid)
{
string strConectionString = ConfigurationManager.AppSettings["DataBaseConnection"];
//set up sql
string StrSql = "SELECT MemberID FROM MEMBERS WHERE (Guid = @GuidID)";
DataTable dt = new DataTable();
using (SqlDataAdapter daObj = new SqlDataAdapter(StrSql, strConectionString))
{
daObj.SelectCommand.Parameters.Add("@GuidID", SqlDbType.Int);
daObj.SelectCommand.Parameters["@GuidID"].Value = guid;
//fill data table
daObj.Fill(dt);
}
return dt;
}