當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。