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


C# IDatabase.ExecuteNonQuery方法代码示例

本文整理汇总了C#中IDatabase.ExecuteNonQuery方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.ExecuteNonQuery方法的具体用法?C# IDatabase.ExecuteNonQuery怎么用?C# IDatabase.ExecuteNonQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDatabase的用法示例。


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

示例1: runDbCommands

 protected void runDbCommands(IDatabase db, IList<string> sqls)
 {
     foreach (string sql in sqls) {
         DbCommand cmd = db.CreateCommand(sql);
         db.ExecuteNonQuery(cmd);
     }
 }
开发者ID:ChristophWurst,项目名称:UFO,代码行数:7,代码来源:IntegrationTest.cs

示例2: SaveDataToDatabase

 public bool SaveDataToDatabase(IDatabase database)
 {
     return database.ExecuteNonQuery(
         "UPDATE characters SET " +
         "level=" + Level + ", " +
         "map_id=" + Map + ", " +
         "pos_x=" + Position.X + ", " +
         "pos_y=" + Position.Y + ", " +
         "pos_z=" + Position.Z + ", " +
         "rot_x=" + Rotation.X + ", " +
         "rot_y=" + Rotation.Y + ", " +
         "rot_z=" + Rotation.Z + " " +
         "WHERE character_id=" + Id) == 1;
 }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:14,代码来源:Character.cs

示例3: UpdateLastInfo

        public bool UpdateLastInfo(IDatabase database, NetworkClient client)
        {
            var t2 = 0;
            DllImport.Other.time(ref t2);

            return database.ExecuteNonQuery("UPDATE accounts SET " +
                                            "last_connection=" + t2 +
                                            ", last_ip='" + client.IpAddress + "'" +
                                            "WHERE account_id=" + Id) == 1;
        }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:10,代码来源:Account.cs

示例4: AddResults

        private void AddResults(int id, string results, DateTime processed, IDatabase db)
        {
            DbCommand command = db.CreateCommand(sqlADDRESULTS);

            command.Parameters.Add(db.CreateParameter("@results", "varchar", results.Length));
            command.Parameters["@results"].Value = results;

            command.Parameters.Add(db.CreateParameter("@processed", "datetime"));
            command.Parameters["@processed"].Value = processed;

            db.ExecuteNonQuery(command);
        }
开发者ID:thompsonx,项目名称:vis_ordinace,代码行数:12,代码来源:SampleRequestMapper.cs

示例5: MigrateTable

        private static void MigrateTable(string table, IDatabase from, IDatabase to)
        {
            var count = 0;
            var sql = string.Format("select * from {0}", table);
            from.ExecuteDataReader(sql, null, dr => {
                var item = new Dictionary<string, object>();
                foreach (var i in Enumerable.Range(0, dr.FieldCount)) {
                    var fieldName = dr.GetName(i);
                    var fieldValue = dr[i];
                    item.Add(fieldName, fieldValue);
                }

                var insertSql = string.Format(@"insert into {0}({1})values({2})",
                    table,
                    string.Join(", ", item.Keys.Select(p => string.Format(@"{0}", p))),
                    string.Join(", ", item.Keys.Select(p => "@" + p)));
                to.ExecuteNonQuery(insertSql, item);

                if (count++ % 1000 == 0)
                    Console.Write(".");
            });
        }
开发者ID:keily,项目名称:LightOne,代码行数:22,代码来源:副本+Program.cs

示例6: CreateTable

		protected internal override void CreateTable(IDatabase db, string tableName, Type entityType)
		{
			if (entityType == typeof(Order))
			{
				// todo:根据模型自动创建表
				db.ExecuteNonQuery(String.Format(@"
CREATE TABLE [{0}](
	[OrderID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](32) NOT NULL,
	[CustomerName] [nvarchar](64) NOT NULL,
	[TS] [timestamp] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[OrderID] ASC
)
) ON [PRIMARY]", tableName));
			}
		}
开发者ID:Kjubo,项目名称:xms.core,代码行数:18,代码来源:BusinessContextTest.cs

示例7: DeleteRowFromTableCalendar

        internal static void DeleteRowFromTableCalendar(IDatabase db, string id, string name)
        {
            string strCommand = "Delete From lichhen";

            strCommand += " Where Idpatient='" + id + "' AND Namepatient='" + name + "';";

            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            db.ExecuteNonQuery(strCommand, null);
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:9,代码来源:Helper.cs

示例8: UpdateRowToTableCalendar

        public static void UpdateRowToTableCalendar(IDatabase db, string nameOfTable, List<string> nameOfColumns,
    List<string> values, string id, string Username)
        {
            string strCommand = BuildFirstPartUpdateQuery(nameOfTable, nameOfColumns, values);

            strCommand += " Where IdCalendar='" + id + "' AND Username='" + Username + "';";

            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            db.ExecuteNonQuery(strCommand, null);
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:10,代码来源:Helper.cs

示例9: DeleteRowToTableCalendar

        public static void DeleteRowToTableCalendar(IDatabase db, string nameOfTable, string id, string Username)
        {
            string strCommand = "Delete From " + nameOfTable;

            strCommand += " Where IdCalendar='" + id + "' AND Username='" + Username + "';";

            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            db.ExecuteNonQuery(strCommand, null);
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:9,代码来源:Helper.cs

示例10: DeleteRowFromTablelistpatienttoday

        public static void DeleteRowFromTablelistpatienttoday(IDatabase db, string id, string name)
        {
            string strCommand = "Delete From listpatienttoday";

            strCommand += " Where Id='" + id + "' AND Name='" + name + "';";

            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            db.ExecuteNonQuery(strCommand, null);
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:9,代码来源:Helper.cs

示例11: UpdateRowToTableMedicine

        internal static void UpdateRowToTableMedicine(IDatabase db, string p, int offset, string p_2)
        {
            //get current number of medicine in store
            string strCommand = "Select Count from medicine where Id = " + p_2;

            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
            reader.Read();
            if (reader.HasRows)
            {
                int numberInStore = int.Parse(reader[DatabaseContants.medicine.Count].ToString());
                int numberWillBe = numberInStore - offset;
                reader.Close();

                strCommand = "Update Medicine Set Count =" + numberWillBe.ToString() + " Where Id =" + p_2;
                db.ExecuteNonQuery(strCommand, null);
            }
            else
            {
                reader.Close();
            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:21,代码来源:Helper.cs

示例12: UpdateRowToTableDoanhThu

        internal static void UpdateRowToTableDoanhThu(IDatabase db, string nameOfTable, List<string> columnsDoanhThu, List<string> valuesDoanhThu, string p_2)
        {
            string strCommand = BuildFirstPartUpdateQuery(nameOfTable, columnsDoanhThu, valuesDoanhThu);

            strCommand += " Where Idpatient='" + p_2 + "'And time=" + ConvertToSqlString(DateTime.Now.ToString("yyyy-MM-dd")) + ";";

            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            db.ExecuteNonQuery(strCommand, null);
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:9,代码来源:Helper.cs

示例13: InsertMedicines

        private int InsertMedicines(Prescription p, IDatabase db)
        {
            int added = 0;
            DbCommand command;

            foreach (Medicine m in p.Medicines)
            {
                command = db.CreateCommand(sqlINSERTMEDICINE);
                command.Parameters.Add(db.CreateParameter("@id", "int"));
                command.Parameters["@id"].Value = p.Id;

                command.Parameters.Add(db.CreateParameter("@medicineid", "int"));
                command.Parameters["@medicineid"].Value = m.Id;

                added += db.ExecuteNonQuery(command);
            }

            return added;
        }
开发者ID:thompsonx,项目名称:vis_ordinace,代码行数:19,代码来源:PrescriptionMapper.cs

示例14: UpdateLastInfo

        public bool UpdateLastInfo(IDatabase database, NetworkClient client)
        {
            var t2 = 0;
            DllImport.Other.time(ref t2);

            return database.ExecuteNonQuery("UPDATE characters SET " +
                                            "last_connection=" + t2 + " " +
                                            "WHERE character_id=" + Id) == 1;
        }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:9,代码来源:Character.cs


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