i have a windows installer which needs to send email daily .the records for the same are retrived from Storedprocedure but i get the below error though i have the field in Storedprocedure . if i exceutes Storedprocedure directly i get the desired data
Service Error on: 18/05/2017 07:19:02 PM Column 'FirstName' does not belong to table . at System.Data.DataRow.GetDataColumn(String columnName) at System.Data.DataRow.get_Item(String columnName)
SqlConnection conn = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText="sp_GetEmails";
cmd.CommandType=CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
foreach (DataRow row in dt.Rows)
{
string name = row["FirstName"].ToString() + " " + row["FamilyName"].ToString();
}