dll

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Test_1.DAL
{
    public class dll
    {
        static SqlConnection con = new SqlConnection("server=DESKTOP-VH35VBK; database=TestProjectDB; integrated security=true");
        SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
        public static void executeQuery(string Query, SqlParameter[] prm)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = Query;
            cmd.Connection = con;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddRange(prm);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

        public static DataSet bind_Grid(string ProcedureName)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = ProcedureName;
            cmd.Connection = con;
            cmd.CommandType = CommandType.StoredProcedure;
          
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            //con.Open();
            da.Fill(ds);
            //con.Close();
            return ds;
           
        }
    }
}

Comments

Popular posts from this blog

webformaspx

common.cs