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


C# SqliteDataReader.GetString方法代码示例

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


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

示例1: BlockData

 public BlockData(SqliteDataReader reader)
 {
     ID = reader.GetInt32(0);
     File = reader.GetString(1);
     Width = reader.GetInt32(2);
     Height = reader.GetInt32(3);
     AvailableWidth = reader.GetInt32(4);
     AvailableHeight = reader.GetInt32(5);
 }
开发者ID:automaticoo,项目名称:UnityEditorProject,代码行数:9,代码来源:Block.cs

示例2: ParseToUser

        internal bool ParseToUser(SqliteDataReader reader)
        {
            bool success = false;

            if (reader.HasRows)
            {
                reader.Read();

                // Follow the SQL -> Data object
                username = reader.GetString(0);
                password = reader.GetString(1);
                fullName = reader.GetString(2);
                dateJoined = reader.GetDateTime(3);

                success = true;
            }

            return success;
        }
开发者ID:pablok2,项目名称:Fridge,代码行数:19,代码来源:UserDefinition.cs

示例3: GetMonsterData

 static public MonsterData GetMonsterData(int id)
 {
     string query = "SELECT * FROM MONSTER where id = " + id;
     reader = ExecuteQuery(query);
     MonsterData monster = new MonsterData();
     if (reader.Read())
     {
         monster.id = reader.GetInt32(0);
         monster.name = reader.GetString(1);
         monster.hp = reader.GetFloat(2);
         monster.attack = reader.GetFloat(3);
         monster.defence = reader.GetFloat(4);
         monster.gold = reader.GetInt32(5);
     }
     reader.Dispose();
     return monster;
 }
开发者ID:shuitian,项目名称:pokemon_rpg,代码行数:17,代码来源:Sql.cs

示例4: GetUserFromReader

        //
        // GetUserFromReader
        //    A helper function that takes the current row from the SQLiteDataReader
        // and hydrates a MembershipUser from the values. Called by the
        // MembershipUser.GetUser implementation.
        //
        private MembershipUser GetUserFromReader(SqliteDataReader reader)
        {
            if (reader.GetString(1)=="") return null;
            object providerUserKey=null;
            string strGooid=Guid.NewGuid().ToString();
            if (reader.GetValue(0).ToString().Length > 0)
                providerUserKey = new Guid(reader.GetValue(0).ToString());
            else
                providerUserKey = new Guid(strGooid);
            string username = reader.GetString(1);
            string email = reader.GetString(2);

            string passwordQuestion = "";
            if (reader.GetValue(3) != DBNull.Value)
                passwordQuestion = reader.GetString(3);

            string comment = "";
            if (reader.GetValue(4) != DBNull.Value)
                comment = reader.GetString(4);

            bool tmpApproved = (reader.GetValue(5) == null);
             bool isApproved=false;
            if(tmpApproved)
            isApproved = reader.GetBoolean(5);

            bool tmpLockedOut = (reader.GetValue(6) == null);
            bool isLockedOut = false;
            if(tmpLockedOut)
            isLockedOut = reader.GetBoolean(6);

            DateTime creationDate = DateTime.Now;
            try
            {
                if (reader.GetValue(6) != DBNull.Value)
                    creationDate = reader.GetDateTime(7);
            }
            catch { }

            DateTime lastLoginDate = DateTime.Now;
            try
            {
                if (reader.GetValue(8) != DBNull.Value)
                    lastLoginDate = reader.GetDateTime(8);
            }
            catch { }

            DateTime lastActivityDate = DateTime.Now;
            try
            {
                if (reader.GetValue(9) != DBNull.Value)
                    lastActivityDate = reader.GetDateTime(9);
            }
            catch { }
            DateTime lastPasswordChangedDate = DateTime.Now;
            try
            {
                if (reader.GetValue(10) != DBNull.Value)
                    lastPasswordChangedDate = reader.GetDateTime(10);
            }
            catch { }

            DateTime lastLockedOutDate = DateTime.Now;
            try
            {
                if (reader.GetValue(11) != DBNull.Value)
                    lastLockedOutDate = reader.GetDateTime(11);
            }
            catch { }

            MembershipUser u = new MembershipUser(this.Name,
                                                  username,
                                                  providerUserKey,
                                                  email,
                                                  passwordQuestion,
                                                  comment,
                                                  isApproved,
                                                  isLockedOut,
                                                  creationDate,
                                                  lastLoginDate,
                                                  lastActivityDate,
                                                  lastPasswordChangedDate,
                                                  lastLockedOutDate);

            return u;
        }
开发者ID:samwa,项目名称:mcms,代码行数:91,代码来源:SQLiteMembershipProvider.cs

示例5: GetTaskCoreFromCursor

        /// <summary>
        /// Gets the taskcore object from the sqlite cursor
        /// </summary>
        /// <param name="cursor">
        /// A <see cref="SqliteDataReader"/>. This won't be traversed, must be 
        /// called each time the cursor moves ahead
        /// </param>
        /// <returns>
        /// A <see cref="TaskCore"/> - allocated and re-created
        /// Returns null if reading failed
        /// </returns>
        public static TaskCore GetTaskCoreFromCursor(SqliteDataReader cursor)
        {
            // this assumes a single task exists

            // the task to be extracted from the cursor
            TaskCore task = new TaskCore ();

            try {
                task.Id = cursor.GetInt32 (cursor.GetOrdinal ("TaskId"));
                task.Depends = cursor.GetInt32 (cursor.GetOrdinal ("Depends"));
                task.Title = cursor.GetString (cursor.GetOrdinal ("Name"));
                task.Description = cursor.GetString (cursor.GetOrdinal ("Description"));
                task.Priority = cursor.GetInt32 (cursor.GetOrdinal ("Priority"));
                task.DueDate = cursor.GetDateTime (cursor.GetOrdinal ("DueDate"));
                task.CreateDate = cursor.GetDateTime (cursor.GetOrdinal ("CreateDate"));
            } catch {
                log.ERROR ("Reading from cursor failed");
                return null;
            }

            // now, extract the comments.
            SqliteCommand cmd = new SqliteCommand (conn);

            cmd.CommandText = String.Format ("SELECT * FROM Comments WHERE (TaskId = {0});", task.Id);
            log.WARN ("Trying to read comments with query - " + cmd.CommandText);

            SqliteDataReader commentCursor = cmd.ExecuteReader ();

            while (commentCursor.Read ()) {
                CommentData comment = new CommentData ();

                try {
                    comment.Id = commentCursor.GetInt32 (commentCursor.GetOrdinal ("CommentID"));
                    comment.TaskId = commentCursor.GetInt32 (commentCursor.GetOrdinal ("TaskId"));
                    comment.Title = commentCursor.GetString (commentCursor.GetOrdinal ("Subject"));
                    comment.Author = commentCursor.GetString (commentCursor.GetOrdinal ("Author"));
                    comment.Content = commentCursor.GetString (commentCursor.GetOrdinal ("Message"));
                    comment.PostDate = commentCursor.GetDateTime (commentCursor.GetOrdinal ("PostDate"));
                    log.DEBUG ("Extracted comment - " + comment.ToString ());
                } catch {
                    log.ERROR ("Something went wrong while retrieving comment");
                    return null;
                }
                task.Comments.Add (comment);
            }
            log.DEBUG ("Extracted task as : " + task.ToString ());
            return task;
        }
开发者ID:skyronic,项目名称:TFAddin,代码行数:59,代码来源:DBHelper.cs

示例6: Deserialize

 public void Deserialize(SqliteDataReader reader)
 {
     this.FullName = reader.GetString (0) as String;
     this.FileName = reader.GetString (1) as String;
     this.LineNumber = reader.GetInt32 (2);
     this.ItemType = (ParserItemType)reader.GetInt32 (3);
     var docValue = reader.GetValue (4);
     if (docValue.GetType () == typeof (String))
         this.Documentation = (string)docValue;
     var extraValue = reader.GetValue (5);
     if (extraValue.GetType () == typeof (string))
         this.Extra = (string)extraValue;
 }
开发者ID:carlosalberto,项目名称:IronPythonBinding,代码行数:13,代码来源:ParserItem.cs

示例7: GetFromReader

		private FileAttributes GetFromReader (SqliteDataReader reader)
		{
			FileAttributes attr = new FileAttributes ();

			attr.UniqueId = GuidFu.FromShortString (reader.GetString (0));
			attr.Path = System.IO.Path.Combine (reader.GetString (1), reader.GetString (2));
			attr.LastWriteTime = StringFu.StringToDateTime (reader.GetString (3));
			attr.LastAttrTime = StringFu.StringToDateTime (reader.GetString (4));
			attr.FilterName = reader.GetString (5);
			attr.FilterVersion = int.Parse (reader.GetString (6));

			if (attr.FilterName == "")
				attr.FilterName = null;

			return attr;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:16,代码来源:FileAttributesStore_Sqlite.cs

示例8: readTyp

        public override List<string> readTyp()
        {
            try {

                sqlite_cmd = sqlite_conn.CreateCommand ();

                sqlite_cmd.CommandText = "SELECT name FROM tbl_typ";

                sqlite_conn.Open ();

                datareader = sqlite_cmd.ExecuteReader ();

                string readname = "";
                List<string> typs = new List<string>(); // To Save typs and return them

                while (datareader.Read())
                {
                    readname = datareader.GetString(0);
                    typs.Add (readname);
                }
                sqlite_conn.Close ();
                return typs;
            }
            catch (Exception ex)
            {
                sqlite_conn.Close ();
                return null;
            }
        }
开发者ID:Bischi,项目名称:personalManager,代码行数:29,代码来源:SQLiteConnection.cs

示例9: readTasks

        public override List<string> readTasks(int areaID)
        {
            try {

                sqlite_cmd = sqlite_conn.CreateCommand ();

                sqlite_cmd.CommandText = "SELECT DISTINCT name FROM tbl_task inner join tbl_workplace on tbl_task.id = tbl_workplace.fk_task WHERE tbl_workplace.fk_area="+areaID+"";

                sqlite_conn.Open ();

                datareader = sqlite_cmd.ExecuteReader ();

                string readname = "";
                List<string> tasks = new List<string>(); // To Save tasks and return them

                while (datareader.Read())
                {
                    readname = datareader.GetString(0);
                    tasks.Add (readname);
                }
                sqlite_conn.Close ();
                return tasks;
            }
            catch (Exception ex)
            {
                sqlite_conn.Close ();
                return null;
            }
        }
开发者ID:Bischi,项目名称:personalManager,代码行数:29,代码来源:SQLiteConnection.cs

示例10: CheckUserLogin

        public int CheckUserLogin(string username, string password)
        {
            string sql = "select password,uid,reg_time from user_info where username = '" + username+"'";
            reader=ExecuteQuery(sql);
            if (reader.HasRows)
            {
				if (reader.Read ()) {
					string cryptopassword = reader.GetString (0);
					int uid = reader.GetInt32 (1);
					int reg_time = reader.GetInt32 (2);
					if (cryptopassword == password && password !="") {
                        User.Instance().ResetUser();
                        User.Instance().InitUser(username,password,uid,reg_time);
						return 1;	
					}
				}
            }
            return -1;
        }
开发者ID:ZhHong,项目名称:u3d_client,代码行数:19,代码来源:SqliteDB.cs

示例11: GetUserDefineData

		public Hashtable GetUserDefineData(string sql){
			//check sql if has *  if has we must checkout of the table struct

			Hashtable tablehead = new Hashtable();

			//get table
			//select * from user where uid =0
			//delete from user where uid=0
			//update user set uname = 1 where uid =0
			//SELECT record_year,record_month,money_class,pay_type,sum(pay_value) from money_record 
			//WHERE uid = 1 GROUP BY record_year,record_month,pay_type ORDER BY record_year,record_month,pay_type;
			if (sql.Contains ("select")) {
				
				if (sql.Contains ("*")) {
					/*
					//SELECT * from sqlite_master WHERE type =="table" AND name ="money_record";
					string table_name = "";
					var temp = sql.Split (new String[] {"from"},StringSplitOptions.RemoveEmptyEntries);
					if (sql.Contains ("where")) {
						var temp1 = temp [1].Split (new String[]{ "where" },StringSplitOptions.RemoveEmptyEntries);
						table_name = temp1 [0];
					} else {
						table_name = temp [1];
					}
					// get table colums names
					string sql_table = "select `sql` from sqlite_master where type = 'table' and name= '" + table_name + "'";
					reader = ExecuteQuery (sql_table);
					if (reader.Read()) {
						string create_sql = reader.GetString (0);
						var temp_cs = create_sql.Split (new char[]{'(',')'},StringSplitOptions.RemoveEmptyEntries);
					}
					*/
					string table_name = "";
					if(sql.Contains("money_record")){
						table_name = "money_record";
					}
					if(sql.Contains("user_info")){
						table_name = "user_info";
					}
					if (table_name != "") {
						string[] sql_arr = GameWorld.getInstance ().getCreateSql ();
						int length_a = sql_arr.Length;
						for (int a = 0; a < length_a; a++) {
							if (sql_arr [a].Contains (table_name)) {
								var temp_cs = sql_arr [a].Split (new String[]{ table_name }, StringSplitOptions.RemoveEmptyEntries);
								var create_struct = temp_cs [1].Split (',');
								int length_b = create_struct.Length;
								for (int b = 0; b < length_b; b++) {
									tablehead [b] = create_struct [b];
								}
							}
						}
					} else {
						for (int i =0 ; i <10;i++){
							tablehead [i] = "colums-" + i;
						}
					}

				} 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{
//.........这里部分代码省略.........
开发者ID:ZhHong,项目名称:u3d_client,代码行数:101,代码来源:SqliteDB.cs

示例12: GetCurrentMoneyRecord

		public Hashtable GetCurrentMoneyRecord(int uid){
            //get current user money record
			getDbData = new Hashtable();
			string sql = "select id,record_year,record_month,record_day,money_class,pay_type,pay_value,msg,insert_time from money_record where uid = "+uid;

            Hashtable tablehead = new Hashtable();
            tablehead[0] = "seq";
            tablehead[1] = "record_time";
            tablehead[2] = "money_class";
            tablehead[3] = "pay_type";
            tablehead[4] = "pay_value";
            tablehead[5] = "msg";
            tablehead[6] = "datetime";

            GameWorld.getInstance().errorData.PushTextTable(tablehead);

            reader = ExecuteQuery (sql);
			if (reader.HasRows) {
                //has records
                int i = 0;
				while(reader.Read()){
					int id = reader.GetInt32 (0);
					int record_year = reader.GetInt32 (1);
					int record_month = reader.GetInt32 (2);
					int record_day = reader.GetInt32 (3);
					int money_class = reader.GetInt32 (4);

                    string money_class_str = GameWorld.getInstance().errorData.GetMoneyTypeStr(money_class);

					int pay_type = reader.GetInt32 (5);
                    string pay_type_str = GameWorld.getInstance().errorData.GetPayTypeStr(pay_type);
					float pay_value = reader.GetFloat (6);
					string msg = reader.GetString (7);
					int insert_time = reader.GetInt32 (8);
                    string insert_time_str = Utils.GetTimeStr(insert_time).ToString();
					string record_time = record_year + "/" + record_month + "/" + record_day;

                    Hashtable temp = new Hashtable();
                    temp[0] = id;
                    temp[1] = record_time;
                    temp[2] = money_class_str;
                    temp[3] = pay_type_str;
                    temp[4] = pay_value;
                    temp[5] = msg;
                    temp[6] = insert_time_str;
					getDbData.Add(i, temp);
                    i++;
				}
			}
			return getDbData;
		}
开发者ID:ZhHong,项目名称:u3d_client,代码行数:51,代码来源:SqliteDB.cs

示例13: GetItemData

 static public ItemData GetItemData(int id)
 {
     string query = "SELECT * FROM ITEM where id = " + id;
     reader = ExecuteQuery(query);
     ItemData item = new ItemData();
     if (reader.Read())
     {
         item.id = reader.GetInt32(0);
         item.name = reader.GetString(1);
         item.addHp = reader.GetFloat(2);
         item.addAttack = reader.GetFloat(3);
         item.addDefence = reader.GetFloat(4);
         item.addGold = reader.GetInt32(5);
     }
     reader.Dispose();
     return item;
 }
开发者ID:shuitian,项目名称:pokemon_rpg,代码行数:17,代码来源:Sql.cs

示例14: GetSafeString

 public string GetSafeString(SqliteDataReader reader, int index)
 {
     if (reader.IsDBNull(index))
         return string.Empty;
     else
         return reader.GetString(index);
 }
开发者ID:DomiStyle,项目名称:DaRT,代码行数:7,代码来源:GUImain.cs

示例15: MeasureFromReader

 private static Measure MeasureFromReader(SqliteDataReader reader)
 {
     MeasureTypes type = MeasureTypes.GetFromId(reader.GetInt32(3));
     if (type == MeasureTypes.Predictor)
     return new Predictor (DataTypes.GetFromName (reader.GetString(2)), reader.GetString (1)) { Id = reader.GetInt32 (0)};
     return new Outcome (DataTypes.GetFromName (reader.GetString(2)), reader.GetString (1)) { Id = reader.GetInt32 (0)};
 }
开发者ID:sydneyos,项目名称:biohack,代码行数:7,代码来源:MeasureRepository.cs


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