using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class _Default :
System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
public void
ExecuteStoredProc()
{
SqlConnection objCon = null;
SqlDataReader objRdr = null;
try
{
objCon = new SqlConnection("...CONNECTION STRING....");
objCon.Open();
SqlCommand cmd = new
SqlCommand("Stored_Proc_Name",
objCon);
cmd.CommandType = CommandType.StoredProcedure;
objRdr = cmd.ExecuteReader();
while (objRdr.Read())
{
Response.Write(objRdr["Emp_Name"].ToString()
+ "<BR>");
}
}
catch (Exception
ex)
{
Response.Write(ex.Message);
}
finally
{
objCon.Close();
objRdr.Close();
}
}
}
No comments:
Post a Comment