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


C# IDatabase.CreateParameter方法代码示例

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


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

示例1: PrepareCommand

        private void PrepareCommand(IDatabase db, DbCommand cmd, SampleRequest er)
        {
            cmd.Parameters.Add(db.CreateParameter("@type", "varchar", er.Type.Length));
            cmd.Parameters["@type"].Value = er.Type;

            cmd.Parameters.Add(db.CreateParameter("@description", "varchar", er.Description.Length));
            cmd.Parameters["@description"].Value = er.Description;

            cmd.Parameters.Add(db.CreateParameter("@date", "datetime"));
            cmd.Parameters["@date"].Value = er.Created;
        }
开发者ID:thompsonx,项目名称:vis_ordinace,代码行数:11,代码来源:SampleRequestMapper.cs

示例2: ReadAllergens

        private List<string> ReadAllergens(Medicine m, IDatabase db)
        {
            DbCommand command = db.CreateCommand(sqlSELECTALLERGENS);
            command.Parameters.Add(db.CreateParameter("@id", "int"));
            command.Parameters["@id"].Value = m.Id;

            DbDataReader areader = db.Select(command);

            List<string> allergens = new List<string>();
            while (areader.Read())
            {
                allergens.Add(areader.GetString(0));
            }

            areader.Close();

            return allergens;
        }
开发者ID:thompsonx,项目名称:vis_ordinace,代码行数:18,代码来源:SqlDbDataSource.cs

示例3: 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

示例4: Read

        private List<Request> Read(DbDataReader reader, IDatabase db)
        {
            List<Request> requests = new List<Request>();
            MedicineMapper medcat = MedicineMapper.GetInstance();

            while (reader.Read())
            {
                Prescription er = new Prescription();
                er.Id = reader.GetInt32(0);
                er.Created = reader.GetDateTime(1);

                DbCommand command = db.CreateCommand(sqlSELECTMEDICINE);
                command.Parameters.Add(db.CreateParameter("@id", "int"));
                command.Parameters["@id"].Value = er.Id;
                DbDataReader medicines = db.Select(command);
                er.Medicines = this.ReadMedicines(medicines, medcat);

                medicines.Close();

                requests.Add(er);
            }

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

示例5: PrepareCommand

        private void PrepareCommand(IDatabase db, DbCommand cmd, Prescription er, string p_id)
        {
            cmd.Parameters.Add(db.CreateParameter("@date", "datetime"));
            cmd.Parameters["@date"].Value = er.Created;

            cmd.Parameters.Add(db.CreateParameter("@person", "char", p_id.Length));
            cmd.Parameters["@person"].Value = p_id;
        }
开发者ID:thompsonx,项目名称:vis_ordinace,代码行数:8,代码来源:PrescriptionMapper.cs

示例6: 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

示例7: AddWithValue

		internal static void AddWithValue(this IDataParameterCollection source, string name, object parameter,
			IDatabase db)
		{
			source.Add(db.CreateParameter(name, parameter));
		}
开发者ID:JPVenson,项目名称:DataAccess,代码行数:5,代码来源:DataHelperExtensions.cs

示例8: PrepareCommand

        private void PrepareCommand(IDatabase db, DbCommand cmd, ExaminationType er)
        {
            cmd.Parameters.Add(db.CreateParameter("@name", "varchar", er.Name.Length));
            cmd.Parameters["@name"].Value = er.Name;

            cmd.Parameters.Add(db.CreateParameter("@description", "varchar", er.Description.Length));
            cmd.Parameters["@description"].Value = er.Description;
        }
开发者ID:thompsonx,项目名称:vis_ordinace,代码行数:8,代码来源:ExaminationTypeMapper.cs


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