Click here to Skip to main content
15,898,769 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ex : create procedure procedurename
as begin
select product_name from tbl_product
end


without using dataset how to get the values in asp.net with c# please i need your help.
Posted
Comments
Arasappan 20-Nov-15 1:59am    
can u please show ur c#

BY means odf Datareader You can drive..

example:

Label.Text=dr[0].ToString();

Step BY Step

declare SQlDataREader;

SqlDataReader dr=new SqlDataReader();
// You may Add using System.Data.SqlClient;

C#
obj.Type=8;   
dr=obj.Type;
dr.Read();
if(dr.HasRows)
{
Label.Text=dr[0].ToString();
dr.Close();
}
 
Share this answer
 
v2
Use
C#
using (SqlConnection con = new SqlConnection("YourConnectionString"))
       {
           con.Open();
           SqlCommand cmd = new SqlCommand("YourProcedureName",con);
           cmd.CommandType = CommandType.StoredProcedure;
           object result = cmd.ExecuteScalar();
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900