コード例 #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);
        }
コード例 #2
0
        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;
 }