当前位置: 首页>>代码示例>>C#>>正文


C# SqliteDataReader.GetFieldType方法代码示例

本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.GetFieldType方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.GetFieldType方法的具体用法?C# SqliteDataReader.GetFieldType怎么用?C# SqliteDataReader.GetFieldType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Data.Sqlite.SqliteDataReader的用法示例。


在下文中一共展示了SqliteDataReader.GetFieldType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUserDefineData


//.........这里部分代码省略.........
						}
					}

				} else {
					var temp = sql.Split(new String[]{"select"},StringSplitOptions.RemoveEmptyEntries);
					var temp1 = temp [0];
					var temp2 = temp1.Split (new String[]{"from"},StringSplitOptions.RemoveEmptyEntries);
					var temp3 = temp2 [0].Split (',');
					int leng_t3 = temp3.Length;
					for (int c=0;c<leng_t3;c++){
						tablehead [c] = temp3 [c];
					}
				}
			}else{
				//update of delete
				if (sql.Contains ("update")) {
					reader = ExecuteQuery (sql);
					throw new Exception ("update affected "+reader.RecordsAffected+" rows");

				} else if(sql.Contains("delete")){
					reader = ExecuteQuery (sql);
					throw new Exception ("delete affected "+ reader.RecordsAffected +" rows");
				}else if (sql.Contains("insert")){
					//insert
					Exception e= null;
					try{
						ExecuteQuery(sql,false);
					}catch(Exception e1){
						e = e1;
						throw e;
					}finally{
						if (e == null) {
							throw new Exception ("insert success!");
						}
					}

				}else if (sql.Contains("create")){
					//create
					Exception e = null;
					try{
						ExecuteQuery(sql,false);
					}catch(Exception e2){
						e = e2;
						throw e;
					}finally{
						if (e == null) {
							throw new Exception ("create new table success!");
						}
					}
				}else if (sql.Contains("drop")){
					Exception e = null;
					try{
						ExecuteQuery(sql,false);
					}catch(Exception e3){
						e = e3;
						throw e;
					}finally{
						if(e == null){
							throw new Exception ("drop table success!");
						}
					}
				}
			}


			//get user self define data
			getDbData = new Hashtable();
			//table head

			reader = ExecuteQuery (sql);
			if (reader.HasRows){
				int i = 0;
				while(reader.Read()){
					Hashtable temp = new Hashtable ();
					for (int j =0;j<reader.FieldCount;j++){
						Type t =reader.GetFieldType (j);
						if(t == typeof(Int32)){
							var val = reader.GetInt32 (j);
							temp [j] = val;
						}
						if (t == typeof(Int64)) {
							var val = reader.GetInt64 (j);
							temp [j] = val;
						}
						if (t == typeof(Double)) {
							var val = reader.GetFloat (j);
							temp [j] = val;
						}
						if (t == typeof(String)) {
							var val = reader.GetString (j);
							temp [j] = val; 
						}
					}
					getDbData.Add (i, temp);
					i++;
				}
			}
			GameWorld.getInstance ().errorData.PushTextTable (tablehead);
			return getDbData;
		}
开发者ID:ZhHong,项目名称:u3d_client,代码行数:101,代码来源:SqliteDB.cs


注:本文中的Mono.Data.Sqlite.SqliteDataReader.GetFieldType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。