Hi all,
Im not a very good developer. I want to know how to call StoredProcedure.
Class
public class SqlManager
{
private SqlConnection sqlCon = null;
private SqlCommand sqlCmd = null;
private SqlDataReader sqlDr = null;
public SqlManager()
{
//
// TODO: Add constructor logic here
//
}
public int AddUser(string query)
{
try
{
using (sqlCon = new SqlConnection("Data Source=localhost;Initial Catalog=My_DB;Integrated Security=True"))
{
using (sqlCmd = new SqlCommand(query, sqlCon))
{
sqlCon.Open();
sqlCmd.CommandType = CommandType.StoredProcedure;
SqlCommandBuilder.DeriveParameters(sqlCmd);
// StoreProcedure sqlCmd.CommandText = "AddU ...
Go to the complete details ...