当前位置: 首页>>代码示例>>C#>>正文


C# SqlDatabase类代码示例

本文整理汇总了C#中SqlDatabase的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabase类的具体用法?C# SqlDatabase怎么用?C# SqlDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SqlDatabase类属于命名空间,在下文中一共展示了SqlDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: sinhvienMainForm_Load

        private void sinhvienMainForm_Load(object sender, EventArgs e)
        {
            //lopItems.Add(new Lop() {
            //    LopId = 1,
            //    TenLop = "cntt k37",
            //    GVCN = "A"
            //});
            //lopItems.Add(new Lop()
            //{
            //    LopId = 2,
            //    TenLop = "cntt k38",
            //    GVCN = "B"
            //});
            //lopItems.Add(new Lop()
            //{
            //    LopId = 3,
            //    TenLop = "cntt k39",
            //    GVCN = "C"
            //});
            var db = new SqlDatabase();
            lopItems = db.GetList<Lop>("select * from lop");

            //lopItems = DataExtensions.GetList<Lop>(db, "select * from Lop");

            lopBindingSource.DataSource = lopItems;
            sinhvienBindingSource.DataSource = data;
        }
开发者ID:stupidguy176,项目名称:Ngungu,代码行数:27,代码来源:sinhvienMainForm.cs

示例2: DoGet

        protected override void DoGet()
        {
            chkDelFlag.Enabled = DbHelper.isAdmin(Page.User.Identity.Name);

            action = Request["Action"];
            txtBuildingId.Text = Request["Id"];

            hidAction.Value = action;

            SqlDatabase db = new SqlDatabase();
            if (action == "Edit")
            {
                lblHeader.Text = "Thông Tin Chi Tiết " + title;
                btnRegister.Text = "Cập Nhật";
                btnCancel.Text = "Đóng";
                btnRegister.CommandName = "Edit";
                if (!IsPostBack)
                {
                    LoadData();
                }
            }
            else // Add new case
            {
                //chkDelFlag.Checked = true;
                //lblHeader.Text = "Thêm Mới " + title;
                //btnRegister.Text = "Thêm Mới";
                //btnRegister.CommandName = "Register";
                //btnCancel.Text = "Đóng";
            }
        }
开发者ID:tuankyo,项目名称:QLTN,代码行数:30,代码来源:BuildingEdit.aspx+(1).cs

示例3: DoLog

 /// <summary>
 /// Override to specify how the trace entry should be logged.
 /// </summary>
 /// <param name="item">Trace entry</param>
 protected override void DoLog(TraceLogItem item)
 {
     using (var db = new SqlDatabase(_sqlConnectionOrName))
     {
         var logRecord = new TraceRecord
             {
                 // ReSharper disable PossibleInvalidOperationException
                 Timestamp = item.TimestampUtc.Value,
                 // ReSharper restore PossibleInvalidOperationException
                 Type = (int)item.Type,
                 OperationType = item.OperationType,
                 SessionId = item.SessionId,
                 BusinessTransactionId = item.BusinessTransactionId,
                 OperationInstanceId = item.OperationInstanceId,
                 TenantId = item.TenantId,
                 Message = item.Message,
                 DetailedMessage = item.DetailedMessage,
                 ServerName = item.ServerName,
                 // ReSharper disable PossibleInvalidOperationException
                 ThreadId = item.ThreadId.Value
                 // ReSharper restore PossibleInvalidOperationException
             };
         db.Insert(logRecord);
     }
 }
开发者ID:gergopados,项目名称:Seemplest,代码行数:29,代码来源:SqlTableTraceLogger.cs

示例4: NotQueuedSanityCheckup

 private static void NotQueuedSanityCheckup()
 {
     lock (_dbLock)
     {
         using (var db = new SqlDatabase<NotQueuedEntry>(NotQueuedLocation))
         {
             const int secondsInWeek = 604800;
             var nowTime = Time.GetNowUnixTimestamp();
             var truncateTime = nowTime - secondsInWeek;
             var removing = false;
             var bubblesToTruncate = new List<NotQueuedEntry>();
             foreach (var possibleBubble in db.Store.Where(x => x.Time < truncateTime))
             {
                 if (!removing)
                 {
                     Utils.DebugPrint("Pruning not queued bubbles database. Some bubbles are too old!");
                 }
                 removing = true;
                 bubblesToTruncate.Add(possibleBubble);
             }
             foreach (var possibleBubble in bubblesToTruncate)
             {
                 db.Remove(possibleBubble);
             }
         }
     }
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:27,代码来源:BubbleQueueManager.cs

示例5: Write

 private static void Write(int operationId,int actionId, string information, string creator,int status)
 {
     string sql = string.Empty;
     StringBuilder sb = new StringBuilder();
     SqlDatabase db = new SqlDatabase(ICJSystem.Instance.ConnectionString1);
     try
     {
         Func.AddSqlString(sb, "INSERT INTO OperationLog");
         Func.AddSqlString(sb, "(");
         Func.AddSqlString(sb, "  [Date],");                
         Func.AddSqlString(sb, "  OperationId,");
         Func.AddSqlString(sb, "  ActionId,");
         Func.AddSqlString(sb, "  Information,");
         Func.AddSqlString(sb, "  [Status],");                
         Func.AddSqlString(sb, "  Creator");
         Func.AddSqlString(sb, ")VALUES");
         Func.AddSqlString(sb, "(");
         Func.AddSqlString(sb, "	'" + DateTime.Now.ToString("yyyyMMddHHmmss") + "',");                
         Func.AddSqlString(sb, "	" + operationId + ",");
         Func.AddSqlString(sb, "	" + actionId + ",");
         Func.AddSqlString(sb, "	'" + information + "',");
         Func.AddSqlString(sb, "	" + status + ",");                
         Func.AddSqlString(sb, "	'" + creator + "'");
         Func.AddSqlString(sb, ")");
         sql = sb.ToString();
         db.ExecuteNonQuery(sql);
     }
     catch (Exception ex)
     {
         ApplicationLog.WriteError(ex);
     }            
 }
开发者ID:tuankyo,项目名称:QLTN,代码行数:32,代码来源:OperationLogger.cs

示例6: DoGet

        protected override void DoGet()
        {
            action = Request["Action"];
            id = Request["id"];
            chkDelFlag.Enabled = DbHelper.isAdmin(Page.User.Identity.Name);

            txtCustomerId.Text = Request["CustomerId"];
            hidId.Value = id;
            hidAction.Value = action;
            txtId.Text = id;
            SqlDatabase db = new SqlDatabase();
            if (action == "Edit")
            {
                lblHeader.Text = "Thông Tin Chi Tiết " + title;
                btnRegister.Text = "Cập Nhật";
                btnCancel.Text = "Đóng";
                btnRegister.CommandName = "Edit";
                txtId.Enabled = false;
                if (!IsPostBack)
                {
                    LoadData();
                }
            }
            else // Add new case
            {
                lblHeader.Text = "Thêm Mới " + title;
                btnRegister.Text = "Thêm Mới";
                btnRegister.CommandName = "Register";
                btnCancel.Text = "Đóng";
            }
        }
开发者ID:tuankyo,项目名称:QLTN,代码行数:31,代码来源:RentContractEdit.aspx.cs

示例7: Load

 public static void Load()
 {
     lock (_lock)
     {
         using (var db = new SqlDatabase<BubbleGroupSettings>(GetPath()))
         {
             var toRemoves = new List<BubbleGroupSettings>();
             foreach (var settings in db.Store.ToList())
             {
                 var bubbleGroup = BubbleGroupManager.Find(settings.Guid);
                 if (bubbleGroup == null)
                 {
                     toRemoves.Add(settings);
                 }
                 else
                 {
                     bubbleGroup.Settings = settings;
                 }
             }
             if (toRemoves.Any())
             {
                 foreach (var toRemove in toRemoves)
                 {
                     db.Remove(toRemove);
                 }
             }
         }
     }
 }
开发者ID:StefanTischler,项目名称:DisaOpenSource,代码行数:29,代码来源:BubbleGroupSettingsManager.cs

示例8: CanGetConnectionWithoutCredentials

 public void CanGetConnectionWithoutCredentials()
 {
     SqlDatabase sqlDatabase = new SqlDatabase();
     sqlDatabase.ConfigurationName = "DbWithSqlServerAuthn";
     sqlDatabase.Initialize(new DatabaseConfigurationView(context));
     Assert.AreEqual("server=localhost;database=northwind;", sqlDatabase.GetConnectionStringWithoutCredentials());
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:7,代码来源:SqlDatabaseFixture.cs

示例9: DoGet

        protected override void DoGet()
        {
            chkDelFlag.Enabled = DbHelper.isAdmin(Page.User.Identity.Name);

            action = Request["Action"];
            id = Request["id"];

            hidId.Value = id;
            hidAction.Value = action;
            hidJobType.Value = Func.ParseString(Request["JobType"]);

            DbHelper.FillList(drpPosition, "Select * from Mst_Position Where Jobtype = '"+ hidJobType.Value +"'", "Position", "id");
            DbHelper.FillListSearch(drpWorkingPlace, "Select WorkingPlaceId + '('+ Name +')' As Name, ID from BD_WorkingPlace Where JobTypeId = '" + hidJobType.Value + "' and BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "' and DelFlag = 0", "Name", "id");

            SqlDatabase db = new SqlDatabase();
            if (action == "Edit")
            {
                lblHeader.Text = "Thông Tin Chi Tiết " + title;
                btnRegister.Text = "Cập Nhật";
                btnCancel.Text = "Đóng";
                btnRegister.CommandName = "Edit";
                txtStaffId.Enabled = false;
                if (!IsPostBack)
                {
                    LoadData();
                }
            }
            else // Add new case
            {
                lblHeader.Text = "Thêm Mới " + title;
                btnRegister.Text = "Thêm Mới";
                btnRegister.CommandName = "Register";
                btnCancel.Text = "Đóng";
            }
        }
开发者ID:tuankyo,项目名称:QLTN,代码行数:35,代码来源:BD_StaffEdit.aspx.cs

示例10: DoGet

        protected override void DoGet()
        {
            action = Request["Action"];
            id = Request["id"];

            hidId.Value = id;
            hidAction.Value = action;

            SqlDatabase db = new SqlDatabase();
            if (action == "Edit")
            {
                lblHeader.Text = "Thông Tin Chi Tiết " + title;
                btnRegister.Text = "Cập Nhật";
                btnCancel.Text = "Đóng";
                btnRegister.CommandName = "Edit";
                if (!IsPostBack)
                {
                    LoadData();
                }
            }
            else // Add new case
            {
                lblHeader.Text = "Thêm Mới " + title;
                btnRegister.Text = "Thêm Mới";
                btnRegister.CommandName = "Register";
                btnCancel.Text = "Đóng";
            }
        }
开发者ID:tuankyo,项目名称:QLTN,代码行数:28,代码来源:VehicleTypeEdit.aspx.cs

示例11: InsertDefaultIfNull

 private static void InsertDefaultIfNull(BubbleGroup group)
 {
     lock (_lock)
     {
         if (group.Settings == null)
         {
             using (var db = new SqlDatabase<BubbleGroupSettings>(GetPath()))
             {
                 var settings = new BubbleGroupSettings
                 {
                     Mute = false,
                     Unread = true,
                     Guid = group.ID,
                     LastUnreadSetTime = 0,
                     ReadTimes = null,
                     ParticipantNicknames = null,
                     NotificationLed = DefaultNotificationLedColor,
                     VibrateOption = null,
                     VibrateOptionCustomPattern = null,
                     Ringtone = null,
                 };
                 db.Add(settings);
                 group.Settings = settings;
             }
         }
     }
 }        
开发者ID:StefanTischler,项目名称:DisaOpenSource,代码行数:27,代码来源:BubbleGroupSettingsManager.cs

示例12: DoGet

        protected override void DoGet()
        {
            chkDelFlag.Enabled = DbHelper.isAdmin(Page.User.Identity.Name);

            DbHelper.FillList(drpJobType, "Select * from Mst_JobType", "Name", "id");
            action = Request["Action"];
            id = Request["id"];

            hidId.Value = id;
            hidAction.Value = action;

            SqlDatabase db = new SqlDatabase();
            if (action == "Edit")
            {
                lblHeader.Text = "Thông Tin Chi Tiết " + title;
                btnRegister.Text = "Cập Nhật";
                btnCancel.Text = "Đóng";
                btnRegister.CommandName = "Edit";
                if (!IsPostBack)
                {
                    LoadData();
                }
            }
            else // Add new case
            {
                lblHeader.Text = "Thêm Mới " + title;
                btnRegister.Text = "Thêm Mới";
                btnRegister.CommandName = "Register";
                btnCancel.Text = "Đóng";
            }
        }
开发者ID:tuankyo,项目名称:QLTN,代码行数:31,代码来源:BD_WorkingHourEdit.aspx.cs

示例13: CanGetConnectionForStringWithNoCredentials

        public void CanGetConnectionForStringWithNoCredentials()
        {
            DatabaseSyntheticConfigSettings settings = new DatabaseSyntheticConfigSettings(TestConfigurationSource.CreateConfigurationSource());
            ConnectionStringSettings data = settings.GetConnectionStringSettings("NewDatabase");
            SqlDatabase sqlDatabase = new SqlDatabase(data.ConnectionString);

            Assert.AreEqual(@"server=(localdb)\v11.0;database=northwind;integrated security=true;", sqlDatabase.ConnectionStringWithoutCredentials);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:8,代码来源:SqlDatabaseFixture.cs

示例14: CanGetConnectionWithoutCredentials

        public void CanGetConnectionWithoutCredentials()
        {
            DatabaseSyntheticConfigSettings settings = new DatabaseSyntheticConfigSettings(TestConfigurationSource.CreateConfigurationSource());
            ConnectionStringSettings data = settings.GetConnectionStringSettings("DbWithSqlServerAuthn");
            SqlDatabase sqlDatabase = new SqlDatabase(data.ConnectionString);

            Assert.AreEqual(@"server=(localdb)\v11.0;database=northwind;", sqlDatabase.ConnectionStringWithoutCredentials);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:8,代码来源:SqlDatabaseFixture.cs

示例15: CanGetConnectionForStringWithNoCredentials

        public void CanGetConnectionForStringWithNoCredentials()
        {
            SqlDatabase sqlDatabase = new SqlDatabase();
            sqlDatabase.ConfigurationName = "NewDatabase";
            sqlDatabase.Initialize(new DatabaseConfigurationView(context));

            Assert.AreEqual("server=localhost;database=northwind;integrated security=true;", sqlDatabase.GetConnectionStringWithoutCredentials());
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:8,代码来源:SqlDatabaseFixture.cs


注:本文中的SqlDatabase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。