日期:2014-05-18 浏览次数:21103 次
DataManagement dm = new DataManagement(); bindingSource1.DataSource = dm.GetPatientOrder(patientId, "", conn); dataGrid1.DataSource = bindingSource1.DataSource; //============================================================== public DataTable GetPatientOrder(string patientId, string orderNo, SQLiteConnection conn) { string sqlSearch = ""; if (orderNo.Trim() != String.Empty) { sqlSearch += " AND Order_no=" + orderNo + " "; } string sql = @"SELECT *,case repeat_indicator when 1 then '长期' ELSE '临时' end repInd, '记录' as Performs FROM ORDERS where PATIENT_ID='" + patientId + "' " + sqlSearch + " "; SQLiteCommand cmd = new SQLiteCommand(sql, conn); SQLiteDataReader rdr = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rdr); rdr.Close(); return dt; }
#region 二分查找 /// <summary> /// 二分查找 /// </summary> /// <param name="CodeData">需查找的条码</param> /// <param name="InfoList">用于存放查询到的该条码的整条数据</param> /// <param name="RowLenght">控制每一行的总长度+2(回车算2个字符)</param> public void Bsearch(string CodeData, ArrayList InfoList,int RowLenght) { try { InfoList.Clear(); FileStream fs = new FileStream(@"MyAppData\data\down\lib.txt", FileMode.Open); long txtLenth = fs.Seek(0, SeekOrigin.End) / RowLenght; string tmp = ""; Byte[] rowData = new Byte[RowLenght]; long low = 0; long high = txtLenth - 1; long mid = 0; bool flag = false; long tmpMid = 0; Encoding chCode = Encoding.GetEncoding("GB2312"); while (low <= high) { mid = (low + high) / 2; fs.Seek(mid * RowLenght, SeekOrigin.Begin); fs.Read(rowData, 0, RowLenght); tmp = ""; tmp = chCode.GetString(rowData, 0, rowData.Length).Trim(); if (CodeDat