using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void sp_GetEmployeeInfo()
{
SqlConnection connection =
new SqlConnection("context connection=true");
try
{
connection.Open();
SqlCommand sqlCommand =
new SqlCommand("SELECT EMPID,EMAIL FROM EMPLOYEE",
connection);
SqlDataReader sqlReader = sqlCommand.ExecuteReader();
SqlContext.Pipe.Send(sqlReader);
}
catch(Exception ex)
{
throw ex;
}
finally
{
if (connection != null)
connection.Close();
}
}
};
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment