SQLite查询系统参数

 public static int GetParameterValue(string parameterName)
        {
            var ds = GetDataSet(connString, string.Format("select * from SystemParameter where ParameterName=‘{0}‘", parameterName));
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                int returnValue = 0;
                try
                {
                    returnValue = Convert.ToInt32(ds.Tables[0].Rows[0]["ParameterValue"]);
                }
                catch
                {
                    throw new Exception("SQLite查询系统参数[" + parameterName + "]异常");
                }
                return returnValue;
            }
            else
            {
                throw new Exception("SQLite查询系统参数[" + parameterName + "]异常");
            }
        }

尝试用一种非常规的方式,学习,理解代码,不急功近利,切记做好一件事,做完美。不断优化,改正,修正

时间: 2024-08-24 20:43:57

SQLite查询系统参数的相关文章

sqlite查询忽略大小写,你踩坑了吗?

前言: 一般数据库查询字符串的时候都是忽略大小写的,但是sqlite查询时是区分大小写的.不过sqlite在定义表/查询的时候支持忽略大小写. 定义数据库表/查询匹配时加COLLATE NOCASE 如: create table if not exists tb_test_case (id text PRIMARY KEY, data text COLLATE NOCASE); select * from tb_test_case where data = 'a'  COLLATE NOCAS

sqlite 查询数据 不用回调

int main( void ){    sqlite3 *db=NULL;    char *zErrMsg = 0;    int rc;    //打开数据库连接    rc = sqlite3_open("zieckey.db", &db);    if( rc )    {      fprintf(stderr, "Can't open sqlite: %s/n", sqlite3_errmsg(db));      sqlite3_close(

Sqlite查询时间段内的数据问题解决!

最近搞Sqlite本地查询,需求为查询某时间段内的数据,在SQL中我们都知道为: [sql] view plaincopyprint? select * from tblName where rDate Between '2008-6-10' and  '2008-6-12' select * from tblName where rDate Between '2008-6-10' and '2008-6-12' 这样子是没有问题的,但是在Sqlite中我们这样子写是得不到结果的,试了好多次终于

iOS sqlite查询当天日期的数据

} NSString*timeFormat = @"%Y-%m-%d"; NSString * sql = [NSString stringWithFormat:@"select * from T_TRAVEL_EXPENSE_RETURNTRIP wherestrftime('%@','now') = strftime('%@',SRV_DATE) and USER_ID='%@' order by CREATE_TIME desc",timeFormat,tim

sqlite查询

private static final String TABLENAME = "mytab"; private SQLiteDatabase db = null; public Qu(SQLiteDatabase db) {  this.db = db; } public List<String> find() {  List<String> all = new ArrayList<String>();  String sql = "se

sqlite 查询db文件中所有的表名

语法:SELECT * FROM sqlite_master WHERE type='table'; 可以列出当前db文件中所有的表的表名.结构如下: 注:网上有人说可以带上db文件的名称,如:SELECT * FROM dbname.sqlite_master WHERE type='table'; 但我试了不行...难道我姿势不对~

SQLite查询记录总数

public int getCount() { SQLiteDatabase db = dbOpenHelper.getReadableDatabase(); Cursor cursor = db.rawQuery("select count(id) from table",null); cursor.moveToFirst(); Long count = cursor.getInt(0); cursor.close(); return count; }

SQLite 查询或更新上一条插入的数据

项目中,需要对上一条插入的数据进行更新.走了写弯路,不过通过网络搜索, 最终解决了问题. 就是使用last_insert_rowid()函数来获得上次插入数据的rowid来定位. 例如: SELECT * FROM table1 WHERE rowid = last_insert_rowid() UPDATE table SET key1 = 'NewValue' WHERE rowid = last_insert_row 实际应用的场景:

SQLite查询是的参数个数