Ejemplo n.º 1
0
        public static object ExecuteScalar(CommandType cmdType, string cmdText, params SQLiteParameter[] commandParameters)
        {
            object result = null;

            switch (databaseType.ToLower())
            {
            case "mysql":
                MySqlParameter[] mysqls = ConvertParamType <MySqlParameter>(commandParameters);
                result = DBHelper.ExecuteScalar(cmdType, cmdText, mysqls);
                break;

            case "sqlite":
                SQLiteParameter[] sQLites = ConvertParamType <SQLiteParameter>(commandParameters);
                result = DBSQLiteHelper.ExecuteScalar(cmdType, cmdText, sQLites);
                break;

            case "access":
                OleDbParameter[] oleDbs = ConvertParamType <OleDbParameter>(commandParameters);
                result = DBAccessHelper.ExecuteScalar(cmdType, cmdText, oleDbs);
                break;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static DataTable LoadDataTable(string commondText, params DbParameter[] dbParameters)
        {
            DataTable dt = null;

            switch (databaseType.ToLower())
            {
            case "mysql":
                MySqlParameter[] mysqls = ConvertParamType <MySqlParameter>(dbParameters);
                dt = DBHelper.SelectDataTable(commondText, mysqls);
                break;

            case "sqlite":
                SQLiteParameter[] sQLites = ConvertParamType <SQLiteParameter>(dbParameters);
                dt = DBSQLiteHelper.SelectDataTable(commondText, sQLites);
                break;

            case "access":
                OleDbParameter[] oleDbs = ConvertParamType <OleDbParameter>(dbParameters);
                dt = DBAccessHelper.SelectDataTable(commondText, oleDbs);
                break;
            }
            return(dt);
        }