예제 #1
0
        public BaseAdapter(string sqlQuery, MsSqlConnection conn)
        {
            adapter = new SqlDataAdapter(sqlQuery, conn.Connection);
            Adapter = adapter;

            Adapter.RowUpdating += new SqlRowUpdatingEventHandler(OnRowUpdating);
            Adapter.RowUpdated  += new SqlRowUpdatedEventHandler(OnRowUpdated);
        }
        public static MsSqlConnection GetConnectionFromCurrentContext(string connectionKey)
        {
            MsSqlConnection conn;

            if (HttpContext.Current == null)
            {
                conn = new MsSqlConnection(connectionKey);
                conn.Connect();
                return(conn);
            }

            if (HttpContext.Current.Items[connectionKey] == null)
            {
                conn = new MsSqlConnection(connectionKey);
                conn.Connect();
                HttpContext.Current.Items[connectionKey] = conn;
                return(conn);
            }
            else
            {
                return((MsSqlConnection)HttpContext.Current.Items[connectionKey]);
            }
        }
예제 #3
0
 public BaseDataAccess(MsSqlConnection c)
 {
     MsConn = c;
 }