Invalid attempt to read when no data is present
From: Andy Sutorius (andy_at_sutorius.com)
Date: 02/24/05
- Next message: Andy Sutorius: "Re: Good, Cheap .NET/SQLServer Web hosting?"
- Previous message: optimizeit_at_cox.net: "problems importing excel workbook and displaying in dynamic datagrid"
- Next in thread: Kevin Spencer: "Re: Invalid attempt to read when no data is present"
- Reply: Kevin Spencer: "Re: Invalid attempt to read when no data is present"
- Reply: Marina: "Re: Invalid attempt to read when no data is present"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Feb 2005 18:00:06 GMT
Hi,
I am getting the error "Invalid attempt to read when no data is present"
when I run the following code. I have checked the sql and it is returning
data. What am I missing?
string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE id =
" + Convert.ToInt16(ddlChooseEmail.SelectedValue.ToString());
SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();
string strSubject = Convert.ToString(dtrEmail["subject"]);
string strContent = Convert.ToString(dtrEmail["content"]);
dtrEmail.Close();
Thanks,
Andy
- Next message: Andy Sutorius: "Re: Good, Cheap .NET/SQLServer Web hosting?"
- Previous message: optimizeit_at_cox.net: "problems importing excel workbook and displaying in dynamic datagrid"
- Next in thread: Kevin Spencer: "Re: Invalid attempt to read when no data is present"
- Reply: Kevin Spencer: "Re: Invalid attempt to read when no data is present"
- Reply: Marina: "Re: Invalid attempt to read when no data is present"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|