public void Save(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("Id", id); cmd.AddString("Name", name, MaxLength.BannerTopics.Name); cmd.AddInt("B1", b1); cmd.AddInt("B2", b2); cmd.AddInt("B3", b3); cmd.AddInt("B4", b4); cmd.AddInt("B5", b5); cmd.AddInt("B6", b6); cmd.AddInt("B7", b7); cmd.AddInt("B8", b8); cmd.AddInt("B9", b9); if (id == 0) { cmd.CommandText = "insert into BannerTopics values (@Name,@B1,@B2,@B3,@B4,@B5,@B6,@B7,@B8,@B9) select @@Identity"; id = (int)(decimal)cmd.ExecuteScalar(); } else { cmd.CommandText = "update BannerTopics set Name=@Name,B1=@B1,B2=@B2,B3=@B3,B4=@B4,B5=@B5,B6=@B6,B7=@B7,B8=@B8,B9=@B9 where Id=@Id"; cmd.ExecuteNonQuery(); } }
public void Save(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("Id", id); cmd.AddInt("PositionId", positionId); cmd.AddDateTime("Date", date); cmd.AddString("Name", name); cmd.AddString("Surname", surname); cmd.AddString("Address", address); cmd.AddString("Phone", phone); cmd.AddString("Link", link); cmd.AddString("Email", email); cmd.AddString("Resume", resume); cmd.AddString("Comments", comments); cmd.AddInt("Status", (int)status); if (id == 0) { cmd.CommandText = "insert into Candidates values (@PositionId,@Date,@Name,@Surname,@Address,@Phone,@Link,@Email,@Resume,@Comments,@Status) select @@Identity"; id = (int)(decimal)cmd.ExecuteScalar(); } else { // cmd.CommandText = "update Competitors set PositionId=@PositionId,Date=@Date,Name=@Name,Surname=@Surname,Address=@Address,Phone=@Phone,Link=@Link,Email=@Email, Resume=@Resume, Comments=@Comments,Status=@Status where Id=@Id"; // cmd.ExecuteNonQuery(); } }
public void Write(LogType logType, string msg) { try { using (GmConnection conn = Global.CreateConnection()) { GmCommand cmd = conn.CreateCommand("insert into Log values (@Time,@SessionId,@LogTypeId,@Page,@Message)"); cmd.AddDateTime("Time", DateTime.Now); cmd.AddInt("SessionId", (int)sessionId); cmd.AddInt("LogTypeId", (int)logType); cmd.AddString("Page", page); cmd.AddString("Message", msg, MaxLength.Log.Message); cmd.ExecuteNonQuery(); } } catch { } switch (logType) { case LogType.Error: case LogType.Exception: if (ctl != null) { ctl.Page.Response.Write(string.Format("<p>{0}</p>", msg)); } break; } }
public static DbDataAdapter CreateDataAdapter(GmConnection conn, Document doc) { DbDataAdapter da = conn.CreateDataAdapter(); GmCommand cmd = conn.CreateCommand(selectCmdText); cmd.AddInt("DocumentId", doc.DocumentId); cmd.AddBool("FactFlag", false); (da as IDbDataAdapter).SelectCommand = cmd.DbCommand; cmd = conn.CreateCommand(insertCmdText); cmd.AddString("ProductCode").SourceColumn = "ProductCode"; cmd.AddString("UnitCode").SourceColumn = "UnitCode"; cmd.AddInt("DocumentId", doc.DocumentId); cmd.AddDecimal("Coef").SourceColumn = "Coef"; cmd.AddDecimal("Count").SourceColumn = "Count"; cmd.AddBool("FactFlag", true); cmd.AddBool("HandledFlag").SourceColumn = "HandledFlag"; cmd.DbCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord; (da as IDbDataAdapter).InsertCommand = cmd.DbCommand; cmd = conn.CreateCommand(deleteCmdText); cmd.AddInt("DocumentProductId").SourceColumn = "DocumentProductId"; (da as IDbDataAdapter).DeleteCommand = cmd.DbCommand; cmd = conn.CreateCommand(updateCmdText); cmd.AddInt("DocumentProductId").SourceColumn = "DocumentProductId"; cmd.AddDecimal("Count").SourceColumn = "Count"; cmd.AddBool("HandledFlag").SourceColumn = "HandledFlag"; (da as IDbDataAdapter).UpdateCommand = cmd.DbCommand; return(da); }
private void InitPager(int parentId, int topNumber, bool enablePager) { ucPager.top = "@TopNumber"; ucPager.fields = "Id, Date, Title, Preview, Header, Link, IsGroup"; ucPager.table = "Articles"; ucPager.cond = "(ParentId = @ParentId) and Articles.Status>=0"; ucPager.order = "Date desc"; if (enablePager) { int count = 0; string cmdText = ucPager.GetCountQuery(); using (GmConnection conn = Global.CreateConnection()) { GmCommand cmd = conn.CreateCommand(cmdText); cmd.AddInt("ParentId", parentId); cmd.AddInt("TopNumber", topNumber); count = (int)conn.ExecuteScalar(cmd); } ucPager.GenerateControls(count); this.SqlDataSource1.SelectCommand = ucPager.GetPageQuery(); } else { ucPager.Visible = false; this.SqlDataSource1.SelectCommand = ucPager.GetSelectQuery(); } }
public void Save(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("Id", id); cmd.AddString("SerialNumber", serialNumber); cmd.AddString("IssueDepartment", issueDepartment); cmd.AddDateTime("IssueDate", issueDate); cmd.AddString("DepartmentCode", departmentCode); cmd.AddString("Surname", surname); cmd.AddString("Name", name); cmd.AddString("MiddleName", middleName); cmd.AddInt("Gender", (int)gender); cmd.AddDateTime("Birthday", birthday); cmd.AddString("BirthPlace", birthPlace); cmd.AddString("Registration", registration); if (id == 0) { cmd.CommandText = "insert into Passports values (@SerialNumber,@IssueDepartment,@IssueDate,@DepartmentCode,@Surname,@Name,@MiddleName,@Gender,@Birthday,@BirthPlace,@Registration) select @@Identity"; id = (int)(decimal)cmd.ExecuteScalar(); } else { cmd.CommandText = "update Passports set SerialNumber=@SerialNumber,IssueDepartment=@IssueDepartment,IssueDate=@IssueDate,DepartmentCode=@DepartmentCode,Surname=@Surname,Name=@Name,MiddleName=@MiddleName,Gender=@Gender,Birthday=@Birthday,BirthPlace=@BirthPlace,Registration=@Registration where Id=@Id"; cmd.ExecuteNonQuery(); } }
public static ReportsDataSet.AnalysisRequestDataTable GetAnalysisRequestTable(ConnectionFactory factory, Config config, int patientId, int analysisId) { DataTable dataTable = new DataTable(); string cmdText = @" select Code, AnalysisTypes.Name as AnalysisTypeName, RequestDate from Analyses left join AnalysisTypes on AnalysisTypes.Id=AnalysisTypeId where "; cmdText += analysisId == 0 ? "PatientId=@PatientId order by RequestDate" : "AnalysisId=@AnalysisId"; using (GmConnection conn = factory.CreateConnection()) { GmCommand cmd = new GmCommand(conn, cmdText); cmd.AddInt("PatientId", patientId); cmd.AddInt("AnalysisId", analysisId); cmd.Fill(dataTable); } ReportsDataSet.AnalysisRequestDataTable dtAnalysisRequest = new ReportsDataSet.AnalysisRequestDataTable(); foreach (DataRow dr in dataTable.Rows) { ReportsDataSet.AnalysisRequestRow row = dtAnalysisRequest.NewAnalysisRequestRow(); row.AnalysisCode = (string)dr["Code"]; row.AnalysisName = (string)dr["AnalysisTypeName"]; row.RequestDate = ((DateTime)dr["RequestDate"]).ToString("dd.MM.yy"); dtAnalysisRequest.AddAnalysisRequestRow(row); } return(dtAnalysisRequest); }
internal void Save(GmConnection conn, int id) { this.id = id; if (id != 0) { foreach (DataRow dr in dt.Rows) { if (dr.RowState == DataRowState.Modified) { int groupId = (int)dr[dcId]; bool isChecked = (bool)dr[dcChecked]; GmCommand cmd = conn.CreateCommand(); if (isChecked) { cmd.CommandText = string.Format("insert into {0} values(@{1},@MedicamentGroupId)", tableName, fieldName); } else { cmd.CommandText = string.Format("delete from {0} where {1}=@{1} and MedicamentGroupId=@MedicamentGroupId", tableName, fieldName); } cmd.AddInt(fieldName, id); cmd.AddInt("MedicamentGroupId", groupId); cmd.ExecuteNonQuery(); } } dt.AcceptChanges(); } }
public void Load(Context context) { if (ranges != null) { throw new Exception("Ranges already loaded."); } GmCommand cmd = context.Conn.CreateCommandById("selectCountFromGisRangesWhereTypeId"); cmd.AddInt("TypeId", id); int count = (int)cmd.ExecuteScalar(); ranges = new List <GRange>(count); if (count > 0) { cmd = context.Conn.CreateCommandById("selectAllFromGisRangesWhereTypeId"); cmd.AddInt("TypeId", id); using (IDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { GRange range = new GRange(context, this, dr); } } } }
public static ReportsDataSet.AnalysisResultDataTable GetAnalysisResultTable(ConnectionFactory factory, Config config, int patientId, int analysisId) { DataTable dataTable = new DataTable(); string cmdText = @" select Code, AnalysisTypes.Name as AnalysisTypeName, ExecutionDate, AnalysisData, HandbookGroupId from Analyses left join AnalysisTypes on AnalysisTypes.Id=AnalysisTypeId where ExecutionDate is not null and "; cmdText += analysisId == 0 ? "PatientId=@PatientId order by ExecutionDate" : "AnalysisId=@AnalysisId"; using (GmConnection conn = factory.CreateConnection()) { GmCommand cmd = new GmCommand(conn, cmdText); cmd.AddInt("PatientId", patientId); cmd.AddInt("AnalysisId", analysisId); cmd.Fill(dataTable); } ReportsDataSet.AnalysisResultDataTable dtAnalysisResult = new ReportsDataSet.AnalysisResultDataTable(); foreach (DataRow dr in dataTable.Rows) { AnalysisData ad = AnalysisData.DeserializeString(dr["AnalysisData"] as string); ReportsDataSet.AnalysisResultRow row = dtAnalysisResult.NewAnalysisResultRow(); row.AnalysisCode = (string)dr["Code"]; row.AnalysisName = (string)dr["AnalysisTypeName"]; row.ExecutionDate = ((DateTime)dr["ExecutionDate"]).ToString("dd.MM.yy"); HandbookGroup hg = config.GetHandbookGroup((string)dr["HandbookGroupId"]); row.Result = ad.GetText(hg); dtAnalysisResult.AddAnalysisResultRow(row); } return(dtAnalysisResult); }
public void Save(Context context) { if (context.ExportMode || updateAttr[Constants.updateAttrCreated]) { GmCommand cmd = context.TargetConn.CreateCommandById("insertIntoGisRanges"); cmd.AddInt("Id", id); cmd.AddInt("TypeId", type.Id); context.Buf.SetRect(cmd.AddBinary("Code"), bounds); cmd.ExecuteNonQuery(); if (!context.ExportMode) { updateAttr = 0; } } if (context.Filter == null) { return; } if (!context.Filter.Includes(BatchLevel.Object)) { return; } if (objects != null) { foreach (GObject obj in objects) { obj.Save(context); } } }
public void Load(Context context) { if (objects != null) { return; } lock (this) { if (objects != null) { return; } GmCommand cmd = context.Conn.CreateCommandById("selectCountFromGisObjectsWhereRangeId"); cmd.AddInt("RangeId", id); int count = (int)cmd.ExecuteScalar(); objects = new List <GObject>(count); if (count > 0) { cmd = context.Conn.CreateCommandById("selectAllFromGisObjectsWhereRangeId"); cmd.AddInt("RangeId", id); using (IDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { GObject.Create(context, this, dr, true); } } } } }
public void Save(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("Id", id); cmd.AddInt("ParentId", (int)parentId); cmd.AddDateTime("Date", date); cmd.AddString("Person", person); cmd.AddString("Title", title); cmd.AddString("Preview", preview); cmd.AddString("Header", header); cmd.AddString("Text", text); cmd.AddString("Company", company); cmd.AddInt("CityId", cityId); cmd.AddString("Address", address); cmd.AddString("Phone", phone); cmd.AddString("Link", link); cmd.AddString("Email", email); cmd.AddInt("Status", (int)status); cmd.AddString("Tag", tag); cmd.AddBoolean("IsGroup", isGroup); if (id == 0) { cmd.CommandText = "insert into Articles values (@ParentId,@Date,@Person,@Title,@Preview,@Header,@Text,@Company,@CityId,@Address,@Phone,@Link,@Email, @Status,@Tag,@IsGroup) select @@Identity"; id = (int)(decimal)cmd.ExecuteScalar(); } else { cmd.CommandText = "update Articles set ParentId=@ParentId,Date=@Date,Person=@Person,Title=@Title,Preview=@Preview,Header=@Header,Text=@Text,Company=@Company,CityId=@CityId,Address=@Address,Phone=@Phone,Link=@Link,Email=@Email,Status=@Status, Tag=@Tag, IsGroup=@IsGroup where Id=@Id"; cmd.ExecuteNonQuery(); } }
public void UpdateState(GmConnection conn) { GmCommand cmd = conn.CreateCommand("update Document set DocumentStateId=@DocumentStateId where DocumentId=@DocumentId"); cmd.AddInt("DocumentId", DocumentId); cmd.AddInt("DocumentStateId", DocumentStateId); cmd.ExecuteNonQuery(); }
public static int SetStatus(GmConnection conn, int id, Status status) { GmCommand cmd = conn.CreateCommand("update Patients set Status=@Status where Id=@Id"); cmd.AddInt("Id", id); cmd.AddInt("Status", (int)status); return(cmd.ExecuteNonQuery()); }
public void Save(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("Id", id); cmd.AddInt("PassportId", passportId); cmd.AddInt("InsuranceId", insuranceId); cmd.AddInt("PatientIdentificationId", patientIdentificationId); cmd.AddInt("DoctorId", doctorId); cmd.AddInt("DiagnosisId", diagnosisId); cmd.AddString("PatientData", patientData.GetXmlString()); cmd.AddString("PatientDescription", patientDescription.GetXmlString()); cmd.AddDateTime("AdmissionDate", admissionDate); cmd.AddInt("WardId", wardId); cmd.AddInt("PatientTypeId", (int)patientTypeId); cmd.AddString("PatientDiagnoses", patientDiagnoses.GetXmlString()); cmd.AddString("DietNumber", dietNumber); cmd.AddInt("Status", (int)status); if (id == 0) { cmd.CommandText = "insert into Patients values (@PassportId,@InsuranceId,@PatientIdentificationId,@DoctorId,@DiagnosisId,@PatientData,@PatientDescription,@AdmissionDate,@WardId,@PatientTypeId,0,null,null,@PatientDiagnoses,@DietNumber, @Status) select @@Identity"; id = (int)(decimal)cmd.ExecuteScalar(); } else { cmd.CommandText = @"update Patients set PassportId=@PassportId,InsuranceId=@InsuranceId,PatientIdentificationId=@PatientIdentificationId,DoctorId=@DoctorId,DiagnosisId=@DiagnosisId,PatientData=@PatientData,PatientDescription=@PatientDescription,AdmissionDate=@AdmissionDate,WardId=@WardId,PatientTypeId=@PatientTypeId,PatientDiagnoses=@PatientDiagnoses,DietNumber=@DietNumber, Status=@Status where Id=@Id"; cmd.ExecuteNonQuery(); } }
public void UpdateTerminalId() { using (GmConnection conn = App.ConnectionFactory.CreateConnection()) { GmCommand cmd = conn.CreateCommand("update [User] set TerminalId=@TerminalId where UserCode=@UserId"); cmd.AddInt("TerminalId", TerminalId); cmd.AddInt("UserId", UserId); cmd.ExecuteNonQuery(); } }
public int SaveWardHistory(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("PatientId", id); cmd.AddDateTime("Date", DateTime.Now); cmd.AddInt("WardId", wardId); cmd.AddInt("PatientTypeId", (int)patientTypeId); cmd.CommandText = "insert into PatientWardHistory values (@PatientId,@Date,@WardId,@PatientTypeId) select @@Identity"; return((int)(decimal)cmd.ExecuteScalar()); }
public static int Remove(GmConnection conn, int id) { GmCommand cmd = conn.CreateCommand("delete from PatientIdentifications where Id=@Id"); cmd.AddInt("Id", id); return(cmd.ExecuteNonQuery()); }
void LoadData() { string cmdText = @" select DocumentProducts.*, StoreProducts.*, Products.Code, Products.Name from DocumentProducts left join StoreProducts on StoreProducts.Id=StoreProductId left join Products on Products.Id=ProductId where DocumentId=@DocumentId"; using (GmConnection conn = App.CreateConnection()) { GmCommand cmd = conn.CreateCommand(cmdText); cmd.AddInt("DocumentId", doc.Id); cmd.Fill(dataTable); } gridView.DataSource = dataTable; chkCompleted.Checked = doc.completed; if (doc.completed) { Control[] controls = { btnAdd, btnRemove, btnOk, dpDate }; foreach (Control ctl in controls) { ctl.Enabled = false; } chkCompleted.Enabled = false; ucSelectProduct.Enabled = false; } }
public void Update(GmConnection conn) { GmCommand cmd = conn.CreateCommand(); cmd.AddInt("Id", id); // cmd.AddInt("RecordId", recordId); cmd.AddDateTime("Date", date); cmd.AddString("Name", name, MaxLength.UserInfo.Name); cmd.AddString("Email", email, MaxLength.UserInfo.Email); cmd.CommandText = "update UserInfo set Date=@Date,Name=@Name,Email=@Email"; if (psw.Length > 0) { cmd.CommandText += ",Psw=@Psw"; cmd.AddString("Psw", psw, MaxLength.UserInfo.Psw); } if (picture.Length > 0) { cmd.CommandText += ",Picture=@Picture"; cmd.AddString("Picture", picture, MaxLength.UserInfo.Picture); } // cmd.AddInt("UserRole", (int)userRole); // cmd.AddInt("Status", (int)status); cmd.CommandText += " where Id=@Id"; cmd.ExecuteNonQuery(); }
public bool IsMultyLoginDenied() { bool denied = false; if (UserId != 0) { using (GmConnection conn = App.ConnectionFactory.CreateConnection()) { GmCommand cmd = conn.CreateCommand("select MultiLoginFlag, lastupdate, GETDATE() from [User] where UserCode=@UserCode"); cmd.AddInt("UserCode", UserId); using (IDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { int i = 0; bool multiLoginFlag = dr.GetBoolean(i++); if (multiLoginFlag) { DateTime lastUpdate = dr.GetDateTime(i++); DateTime curTime = dr.GetDateTime(i++); TimeSpan ts = curTime - lastUpdate; denied = ts.TotalMilliseconds < this.config.PollTime * 2; //+config.CommandTimeout*1000 } } } } } return(denied); }
void LoadData() { string cmdText = ""; if (doc.IsNew) { cmdText = "select top 0 * from DocumentProducts"; } else { cmdText = @" select DocumentProducts.*, StoreProducts.*, Products.Code, Products.Name from DocumentProducts left join StoreProducts on StoreProducts.Id=StoreProductId left join Products on Products.Id=ProductId where DocumentId=@DocumentId"; } using (GmConnection conn = App.CreateConnection()) { GmCommand cmd = conn.CreateCommand(cmdText); cmd.AddInt("DocumentId", doc.Id); cmd.Fill(dataTable); } if (gridView.Visible) { gridView.DataSource = dataTable; } }
public static void Vote(GmConnection conn, int pollAnswerId) { GmCommand cmd = conn.CreateCommand("update PollAnswers set Count=Count+1 where Id=@Id"); cmd.AddInt("Id", pollAnswerId); cmd.ExecuteNonQuery(); }
public static int Remove(GmConnection conn, int id) { GmCommand cmd = conn.CreateCommand("delete from LinkExchange where Id=@Id"); //!!! cmd.AddInt("Id", id); return(cmd.ExecuteNonQuery()); }
public static ReportsDataSet.PatientMedicamentsDataTable GetPatientMedicamentsTable(ConnectionFactory factory, int patientId) { ReportsDataSet.PatientMedicamentsDataTable dtPatientMedicaments = new ReportsDataSet.PatientMedicamentsDataTable(); string cmdText = @" SELECT StoreProducts.Id, Products.Name, Products.PackedNumber, Products.Maker, Prescriptions.Dose * Prescriptions.Multiplicity * Prescriptions.Duration AS Count, StoreProducts.Price, Prescriptions.Dose * Prescriptions.Multiplicity * Prescriptions.Duration * StoreProducts.Price AS Sum, Series, MedLists FROM Prescriptions LEFT OUTER JOIN StoreProducts ON StoreProducts.Id = Prescriptions.StoreProductId LEFT OUTER JOIN Products ON Products.Id = StoreProducts.ProductId WHERE Prescriptions.PatientId = @PatientId"; using (GmConnection conn = factory.CreateConnection()) { GmCommand cmd = conn.CreateCommand(cmdText); cmd.AddInt("PatientId", patientId); conn.Fill(dtPatientMedicaments, cmd); } int index = 0; foreach (ReportsDataSet.PatientMedicamentsRow row in dtPatientMedicaments.Rows) { row.Id = ++index; } return(dtPatientMedicaments); }
public void Remove(Context context) { GmCommand cmd = context.Conn.CreateCommandById("deleteFromGisLayersWhereId"); cmd.AddInt("Id", id); cmd.ExecuteNonQuery(); }
void LoadLib(Context context) { int[] indexerCode; GmCommand cmd = context.Conn.CreateCommandById("selectAllFromGisLibWhereId"); cmd.AddInt("Id", Constants.currentLib); using (IDataReader dr = cmd.ExecuteReader()) { if (!dr.Read()) { throw new GeoLibException("Lib record not found."); } attr = dr.GetInt32((int)LibField.Attr); name = dr.GetString((int)LibField.Name); // DZ 16.01.09 // context.SetStyle(dr.GetString((int)LibField.Style),ref styleStr,ref style); context.SetStyle(dr.IsDBNull((int)LibField.Style) ? "" : dr.GetString((int)LibField.Style), ref styleStr, ref style); // context.SetStyle(dr.GetString((int)LibField.DefaultStyle),ref defaultStyleStr,ref defaultStyle.style); context.SetStyle(dr.IsDBNull((int)LibField.DefaultStyle) ? "" : dr.GetString((int)LibField.DefaultStyle), ref defaultStyleStr, ref defaultStyle); smin = dr.GetInt32((int)LibField.SMin); smax = dr.GetInt32((int)LibField.SMax); bounds = context.Buf.GetRect(dr, (int)LibField.Code); indexerCode = context.Buf.GetIntArray(dr, (int)LibField.IndexerCode); scales.Values = context.Buf.GetIntArray(dr, (int)LibField.Scales); } if (scales.Count == 0) { scales.InitScales(); } id = Constants.currentLib; indexer = new Indexer(indexerCode); }
/* public static StoreProduct GetStoreProduct(GmConnection conn, int id) * { * if (id == 0) return null; * GmCommand cmd = conn.CreateCommand("select * from StoreProducts where Id=@Id"); * cmd.AddInt("Id", id); * using (DbDataReader dr = cmd.ExecuteReader()) * { * if (dr.Read()) return new StoreProduct(dr); * } * return null; * }*/ public static int Remove(GmConnection conn, int id, DbTransaction trans) { GmCommand cmd = conn.CreateCommand("delete from StoreProducts where Id=@Id", trans); cmd.AddInt("Id", id); return(cmd.ExecuteNonQuery()); }
public string GetAnalysesList(GmConnection conn) { StringBuilder sb = new StringBuilder(); GmCommand cmd = conn.CreateCommand( @"select RequestDate, Name from Analyses left join AnalysisTypes on AnalysisTypes.Id=AnalysisTypeId where PatientId=@Id"); cmd.AddInt("Id", id); using (DbDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { int i = 0; DateTime dt = dr.GetDateTime(i++); string name = dr.GetString(i++); if (sb.Length > 0) { sb.Append("; "); } sb.AppendFormat("{0:dd.MM} {1}", dt, name); } } if (sb.Length > 0) { sb.Append("."); } return(sb.ToString()); }