Hi,

ExecuteNonQuery = "Executes a Transact-SQL statement against the connection and 
returns the number of rows affected."

Is not the correct method to extract some information.



From: Alen Alexander 
Sent: Monday, May 03, 2010 8:42 AM
To: [email protected] 
Subject: [DotNetDevelopment] Filling Labels with Data from database


Frnds, 
My Web page contains multiple Label controls(10 in total). I want to fill all 
those controls with the values extracted from database.
But corresponding labels are not getting filled with Right data from database.
I am using ASP.NET with C# and SQL Server 2005.
My Code for getting values are.. 


 cmd = new SqlCommand("select * from mid_zone where p_id=2");
 rd= cms.ExecuteNonQuery();
while(rd.Read())
{
 //reading values
}
Please help... 
Thanks in Advance
-- 

Reply via email to