コード例 #1
0
ファイル: Drug_C.cs プロジェクト: laucy/Hospital
        public static List <Drug> Select(string did)
        {
            OdbcConnection odbcConnection = DB.DBManager.GetOdbcConnection();

            odbcConnection.Open();
            string         sql            = "SELECT * FROM drug WHERE `D_ID` LIKE '%" + did + "%'";
            OdbcCommand    odbcCommand    = new OdbcCommand(sql, odbcConnection);
            OdbcDataReader odbcDataReader = odbcCommand.ExecuteReader(CommandBehavior.CloseConnection);

            if (odbcDataReader.HasRows)
            {
                List <Drug> list = Drug.getList(odbcDataReader);
                odbcConnection.Close();
                return(list);
            }
            else
            {
                odbcConnection.Close();
            }
            return(null);
        }