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


C# SQLiteCommand.ToString方法代码示例

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


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

示例1: GMSELF

 /// <summary>
 /// Gets the logged in GM name from the database.
 /// </summary>
 /// <returns>String containing currently logged in GM name.</returns>
 internal static string GMSELF()
 {
     using (SQLiteConnection db = OPENDB())
     {
         string queryString = "SELECT `Name` FROM `gm` WHERE `Name` = (SELECT `Data` FROM `Data` WHERE `Name` = 'Login' LIMIT 1) COLLATE NOCASE LIMIT 1";
         object result = new SQLiteCommand(queryString, db).ExecuteScalar();
         if (result == null)
             return "";
         else
             return result.ToString();
     }
 }
开发者ID:tylorhl,项目名称:NetworkManager,代码行数:16,代码来源:DBMethods.cs

示例2: GenerateUID

        /// <summary>
        /// Generates a uniquely incremented ID based off of the currently logged in GM's ID and the table in question.
        /// </summary>
        /// <param name="table">The table that will require the unique ID.</param>
        /// <returns>A long integer containing a unique ID.</returns>
        internal static long GenerateUID(string table)
        {
            var db = OPENDB();
            string GM = GMSELF();
            string queryString = "SELECT MAX(ID) FROM `" + table + "` WHERE GM = '" + GM + "'  COLLATE NOCASE;";
            object result = new SQLiteCommand(queryString, db).ExecuteScalar();
            if(result != null && result.ToString() != "")
            {
                long maxID = Int64.Parse(result.ToString());

                //Create a deca-shift
                int GMID = IDFromGM(GM);
                int digitCount = (int)Math.Log10((double)GMID);
                digitCount++; //Now have the number of digits in the ID

                //Divide by the number of digits in the GMID to get rid of it.
                maxID /= (int)Math.Pow(10, digitCount);

                //Now we're left with just the increment portion. Increment it.
                maxID++;

                //Reassemble unique ID. It's out new max ID.
                maxID = long.Parse(maxID + "" + GMID);

                return maxID;
            }
            else
            {
                return long.Parse("1" + IDFromGM(GM));
            }
        }
开发者ID:tylorhl,项目名称:NetworkManager,代码行数:36,代码来源:DBMethods.cs

示例3: ExecuteScalar

        /// <summary>
        /// Retrieve single items from the DB.
        /// </summary>
        /// <param name="sql">The query to run.</param>
        /// <returns>A string.</returns>
        public string ExecuteScalar(string sql)
        {
            SQLiteConnection connection = new SQLiteConnection(connectionString);
              try
              {
            connection.Open();

            var value = new SQLiteCommand(connection)
            {
              CommandText = sql
            }.ExecuteScalar();

            if (value != null)
            {
              return (value.ToString());
            }

            return (string.Empty);
              }
              catch
              {
            return (string.Empty);
              }
              finally
              {
            connection.Close();
              }
        }
开发者ID:haivido,项目名称:Vido,代码行数:33,代码来源:SQLiteDatabase.cs


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