-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Ambrose
Message 1 in Discussion

Hi All, I have the below code. I am getting the error Invalid casting. Can some body 
tell me what i am doing wrong.  
string ConString=ConfigurationSettings.AppSettings[0]; 
SqlConnection Con=new SqlConnection(); 
Con.ConnectionString=ConString; 
SqlCommand Cmd=new SqlCommand(); 
Cmd.CommandType=CommandType.Text; 
Cmd.CommandText="sp_help Titles"; 
Cmd.Connection=Con; 
Con.Open(); 
SqlDataReader oReader=Cmd.ExecuteReader(); 
string strValues; 
string strHeader; 
while(oReader.Read()) 
{ 
strValues=""; 
strHeader=""; 
for(int i=0;i<oReader.FieldCount;i++) 
{ 
if(!oReader.IsDBNull(i) && oReader.GetName(i).Length > 0) 
strHeader+=oReader.GetName(i); 
if(!oReader.IsDBNull(i) && oReader.GetString(i).Length > 0) 
strValues+=oReader.GetString(i); 
} 
lblSQL.Text+=strHeader + "<br>-----------------------------<br>" + strValues + 
"<br><br><br>" ; 
oReader.NextResult(); 
} 
connection string I am taking from the web.config. 
Thanks 
Anandraj.A.  

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to