• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Sqlite.SqliteParameter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SqliteParameter类属于Mono.Data.Sqlite命名空间,在下文中一共展示了SqliteParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ClearItemsBeforeDate

        /// <summary>
        /// Clears all items from the database where their PublishDate is before the date provided.
        /// </summary>
        /// <param name="date"></param>
        public void ClearItemsBeforeDate(DateTime date)
        {
            try
            {
                using (SqliteConnection connection = new SqliteConnection(ItemsConnectionString))
                {
                    connection.Open();
                    using (SqliteCommand command = new SqliteCommand(connection))
                    {
                        string sql = @"DELETE FROM items WHERE DATETIME(publishdate) <= DATETIME(@date)";
                        command.CommandText = sql;

                        SqliteParameter parameter = new SqliteParameter("@date", DbType.String);
                        parameter.Value = date.ToString("yyyy-MM-dd HH:mm:ss");
                        command.Parameters.Add(parameter);

                        int rows = command.ExecuteNonQuery();
                        Logger.Info("ClearItemsBeforeDate before {0} cleared {1} rows.", date.ToString("yyyy-MM-dd HH:mm:ss"), rows);
                    }
                }
            }
            catch (SqliteException e)
            {
                Logger.Warn("SqliteException occured while clearing items before {0}: \n{1}", date, e);
            }
        }
开发者ID:yetanotherchris,项目名称:really-simple,代码行数:30,代码来源:SqliteRepository.cs


示例2: FindByName

        public DataStructure FindByName(string username)
        {
            lock (singelton)
            {
                try
                {
                    string sql = "select * from users where username=:USERNAME limit 1";
                    this.command = (IDbCommand)this.connection.CreateCommand ();
                    this.command.CommandText = sql;

                    SqliteParameter param = new SqliteParameter ();
                    param.ParameterName = ":USERNAME";
                    param.Value = username;
                    param.DbType = DbType.String;

                    this.command.Parameters.Add (param);
                    IDataReader dr = (IDataReader)this.command.ExecuteReader ();

                    if (dr.Read ())
                    {
                        return new DataStructure () { id = int.Parse((string)dr["id"].ToString()), username = dr["username"].ToString(), password = (string)dr["password"].ToString(), admin = bool.Parse(dr["admin"].ToString()) };
                    }
                    return null;
                }
                catch(SqliteException e)
                {
                    return null;
                }
            }
        }
开发者ID:Monarch73,项目名称:nccchat,代码行数:30,代码来源:UserDB.cs


示例3: AccountClearLockout

        public static bool AccountClearLockout(Guid userGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE mp_Users ");
            sqlCommand.Append("SET IsLockedOut = 0,  ");
            sqlCommand.Append("FailedPasswordAttemptCount = 0, ");
            sqlCommand.Append("FailedPwdAnswerAttemptCount = 0 ");

            sqlCommand.Append("WHERE UserGuid = :UserGuid  ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0] = new SqliteParameter(":UserGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = userGuid.ToString();

            int rowsAffected = 0;

            rowsAffected = SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return (rowsAffected > 0);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:25,代码来源:dbSiteUser.cs


示例4: SetAdmin

        public bool SetAdmin(int userId)
        {
            lock (singelton)
            {
                try
                {
                    string sql = "update users set admin=:ADMIN where id=:USERID";

                    this.command = (IDbCommand)this.connection.CreateCommand ();
                    this.command.CommandText = sql;
                    this.command.CommandType = CommandType.Text;

                    SqliteParameter param1 = new SqliteParameter () { ParameterName = ":ADMIN", Value = true, DbType = DbType.Boolean };
                    SqliteParameter param2 = new SqliteParameter () { ParameterName = ":USERID", Value = userId, DbType = DbType.Int16 };

                    this.command.Parameters.Add (param1);
                    this.command.Parameters.Add (param2);

                    return (bool)(this.command.ExecuteNonQuery () == 0);
                }
                catch(SqliteException e)
                {
                    return false;
                }
            }
        }
开发者ID:Monarch73,项目名称:nccchat,代码行数:26,代码来源:UserDB.cs


示例5: Create

        /// <summary>
        /// Inserts a row in the mp_TaxClass table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="title"> title </param>
        /// <param name="description"> description </param>
        /// <param name="lastModified"> lastModified </param>
        /// <param name="created"> created </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            string title,
            string description,
            DateTime lastModified,
            DateTime created)
        {
            #region Bit Conversion

            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_TaxClass (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("LastModified, ");
            sqlCommand.Append("Created )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":LastModified, ");
            sqlCommand.Append(":Created )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[6];

            arParams[0] = new SqliteParameter(":Guid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = guid.ToString();

            arParams[1] = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = siteGuid.ToString();

            arParams[2] = new SqliteParameter(":Title", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = title;

            arParams[3] = new SqliteParameter(":Description", DbType.Object);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = description;

            arParams[4] = new SqliteParameter(":LastModified", DbType.DateTime);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = lastModified;

            arParams[5] = new SqliteParameter(":Created", DbType.DateTime);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value = created;

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:70,代码来源:DBTaxClass.cs


示例6: AdjustTrackOrdersForDelete

        /// <summary>
        /// Updates the TrackOrder values for the tracks that remain for the PlayerID by incrementing any Tracks that have a TrackOrder value
        /// greater than the provided trackOrder.
        /// </summary>
        /// <param name="playerID">The ID of the Player.</param>
        /// <param name="trackOrder">The TrackOrder value.</param>
        /// <returns>The number of rows affected by the update.</returns>
        public static int AdjustTrackOrdersForDelete(int playerId, int trackOrder)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE mp_MediaTrack ");
            sqlCommand.Append("SET TrackOrder = TrackOrder - 1 ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("PlayerID = :PlayerID ");
            sqlCommand.Append("AND TrackOrder > :TrackOrder ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0] = new SqliteParameter(":PlayerID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = playerId;

            arParams[1] = new SqliteParameter(":TrackOrder", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = trackOrder;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return rowsAffected;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:34,代码来源:DBMediaTrack.cs


示例7: Delete

        public static bool Delete(
			string loginProvider, 
			string providerKey, 
			string userId)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("DELETE FROM mp_UserLogins ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("LoginProvider = :LoginProvider AND ");
            sqlCommand.Append("ProviderKey = :ProviderKey AND ");
            sqlCommand.Append("UserId = :UserId ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0] = new SqliteParameter(":LoginProvider", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = loginProvider;

            arParams[1] = new SqliteParameter(":ProviderKey", DbType.String, 128);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = providerKey;

            arParams[2] = new SqliteParameter(":UserId", DbType.String, 128);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = userId;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return (rowsAffected > 0);
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:34,代码来源:DBUserLogins.cs


示例8: CreateParameter

 public override IDataParameter CreateParameter(string name, DbType dbType, object value)
 {
     SqliteParameter p = new SqliteParameter(name);
     p.DbType = dbType;
     p.Value = value;
     return p;
 }
开发者ID:Devang83,项目名称:csc131,代码行数:7,代码来源:SQLite.cs


示例9: DeleteByModule

        public static bool DeleteByModule(int moduleId)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("DELETE FROM mp_MediaFile ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("FileID  ");
            sqlCommand.Append("IN (");
            sqlCommand.Append("SELECT FileID FROM mp_MediaFile WHERE TrackID IN (");
            sqlCommand.Append("SELECT TrackID FROM mp_MediaTrack WHERE PlayerID IN (");
            sqlCommand.Append("SELECT PlayerID FROM mp_MediaPlayer WHERE ModuleID = :ModuleID");
            sqlCommand.Append(")");
            sqlCommand.Append(")");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0] = new SqliteParameter(":ModuleID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = moduleId;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return (rowsAffected > 0);
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:28,代码来源:DBMediaFile.cs


示例10: Add

        public static int Add(
            Guid guid,
            Guid siteGuid,
            string folderName)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_SiteFolders (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("FolderName )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":FolderName );");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0] = new SqliteParameter(":Guid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = guid.ToString();

            arParams[1] = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = siteGuid.ToString();

            arParams[2] = new SqliteParameter(":FolderName", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = folderName;

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:34,代码来源:dbSiteFolder.cs


示例11: AccountLockout

        public static bool AccountLockout(Guid userGuid, DateTime lockoutTime)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE mp_Users ");
            sqlCommand.Append("SET IsLockedOut = 1,  ");
            sqlCommand.Append("LastLockoutDate = :LockoutTime  ");
            sqlCommand.Append("WHERE UserGuid = :UserGuid  ;");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0] = new SqliteParameter(":UserGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = userGuid.ToString();

            arParams[1] = new SqliteParameter(":LockoutTime", DbType.DateTime);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = lockoutTime;

            int rowsAffected = 0;

            rowsAffected = SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return (rowsAffected > 0);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:27,代码来源:dbSiteUser.cs


示例12: LoadFavoriteBill

        public Bill LoadFavoriteBill(int id)
        {
            Bill favBill;

            using (var connection = new SqliteConnection (connectionString)) {
                using (var cmd = connection.CreateCommand ()) {
                    connection.Open ();

                    cmd.CommandText = "SELECT * FROM FavoriteBills WHERE id = @id";
                    var idParam = new SqliteParameter ("@id", id);
                    cmd.Parameters.Add (idParam);

                    using (var reader = cmd.ExecuteReader ()) {
                        reader.Read ();
                        favBill = new Bill {
                            Id = Convert.ToInt32 (reader ["id"]),
                            Title = (string)reader ["title"],
                            ThomasLink = (string)reader ["thomas_link"],
                            Notes = reader["notes"] == DBNull.Value ? "" : (string)reader["notes"]
                        };
                    }
                }
            }

            return favBill;
        }
开发者ID:MilenPavlov,项目名称:PortableRazorStarterKit,代码行数:26,代码来源:DataAccess.cs


示例13: CreateParameter

 private static SqliteParameter CreateParameter(string paramName, DbType paramType, object paramValue)
 {
     var param = new SqliteParameter();
     param.DbType = paramType;
     param.ParameterName = paramName;
     param.Value = paramValue;
     return param;
 }
开发者ID:kevins1022,项目名称:Altman,代码行数:8,代码来源:SqliteHelper.cs


示例14: Add

        /// <summary>
        /// Inserts a row in the mp_Surveys table. Returns rows affected count.
        /// </summary>
        /// <param name="surveyGuid"> surveyGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="surveyName"> surveyName </param>
        /// <param name="creationDate"> creationDate </param>
        /// <param name="startPageText"> startPageText </param>
        /// <param name="endPageText"> endPageText </param>
        /// <returns>int</returns>
        public static int Add(
            Guid surveyGuid,
            Guid siteGuid,
            string surveyName,
            DateTime creationDate,
            string startPageText,
            string endPageText)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_Surveys (");
            sqlCommand.Append("SurveyGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("SurveyName, ");
            sqlCommand.Append("CreationDate, ");
            sqlCommand.Append("StartPageText, ");
            sqlCommand.Append("EndPageText )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":SurveyGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":SurveyName, ");
            sqlCommand.Append(":CreationDate, ");
            sqlCommand.Append(":StartPageText, ");
            sqlCommand.Append(":EndPageText )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[6];

            arParams[0] = new SqliteParameter(":SurveyGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = surveyGuid.ToString();

            arParams[1] = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = siteGuid.ToString();

            arParams[2] = new SqliteParameter(":SurveyName", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = surveyName;

            arParams[3] = new SqliteParameter(":CreationDate", DbType.DateTime);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = creationDate;

            arParams[4] = new SqliteParameter(":StartPageText", DbType.Object);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = startPageText;

            arParams[5] = new SqliteParameter(":EndPageText", DbType.Object);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value = endPageText;

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:66,代码来源:DBSurvey.cs


示例15: CountUsersNotSubscribedByLetter

        public static int CountUsersNotSubscribedByLetter(Guid siteGuid, Guid letterInfoGuid, bool excludeIfAnyUnsubscribeHx)
        {
            int intExcludeIfAnyUnsubscribeHx = 0;
            if (excludeIfAnyUnsubscribeHx)
            {
                intExcludeIfAnyUnsubscribeHx = 1;
            }

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT COUNT(*)  ");

            sqlCommand.Append("FROM mp_Users u ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("u.SiteGuid = :SiteGuid ");
            sqlCommand.Append("AND u.IsDeleted = 0 ");
            sqlCommand.Append("AND u.ProfileApproved = 1 ");
            sqlCommand.Append("AND u.IsLockedOut = 0 ");
            sqlCommand.Append("AND (u.RegisterConfirmGuid IS NULL OR u.RegisterConfirmGuid = '00000000-0000-0000-0000-000000000000') ");

            sqlCommand.Append("AND u.UserGuid NOT IN ");
            sqlCommand.Append("(SELECT ls.UserGuid ");
            sqlCommand.Append("FROM mp_LetterSubscribe ls ");
            sqlCommand.Append("WHERE ls.LetterInfoGuid = :LetterInfoGuid ");
            sqlCommand.Append(") ");

            sqlCommand.Append("AND u.UserGuid NOT IN ");
            sqlCommand.Append("(SELECT lsx.UserGuid ");
            sqlCommand.Append("FROM mp_LetterSubscribeHx lsx ");
            sqlCommand.Append("WHERE ((:ExcludeIfAnyUnsubscribeHx = 1) OR (lsx.LetterInfoGuid = :LetterInfoGuid)) ");
            sqlCommand.Append(") ");

            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0] = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = siteGuid.ToString();

            arParams[1] = new SqliteParameter(":LetterInfoGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = letterInfoGuid.ToString();

            arParams[2] = new SqliteParameter(":ExcludeIfAnyUnsubscribeHx", DbType.Int32);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = intExcludeIfAnyUnsubscribeHx;

            int count = Convert.ToInt32(SqliteHelper.ExecuteScalar(
                GetConnectionString(),
                sqlCommand.ToString(),
                arParams));

            return count;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:55,代码来源:DBLetterSubscription.cs


示例16: AddParameters

        public static void AddParameters(SqliteCommand cmd, Object obj, Dictionary<string, DbType> lookup)
        {
            foreach (PropertyInfo prop in obj.GetType ().GetProperties ()) {
                SqliteParameter param = new SqliteParameter ();

                param.ParameterName = "@" + prop.Name;
                param.Value = prop.GetValue (obj, null);
                param.DbType = lookup [prop.Name];
                cmd.Parameters.Add (param);
            }
        }
开发者ID:jacintos,项目名称:papeles,代码行数:11,代码来源:Database.cs


示例17: Add

        /// <summary>
        /// Inserts a row in the mp_SurveyPages table. Returns rows affected count.
        /// </summary>
        /// <param name="pageGuid"> pageGuid </param>
        /// <param name="surveyGuid"> surveyGuid </param>
        /// <param name="pageTitle"> pageTitle </param>
        /// <param name="pageOrder"> pageOrder </param>
        /// <param name="pageEnabled"> pageEnabled </param>
        /// <returns>int</returns>
        public static int Add(
            Guid pageGuid,
            Guid surveyGuid,
            string pageTitle,
            bool pageEnabled)
        {
            #region Bit Conversion

            int intPageEnabled;
            if (pageEnabled)
            {
                intPageEnabled = 1;
            }
            else
            {
                intPageEnabled = 0;
            }

            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_SurveyPages (");
            sqlCommand.Append("PageGuid, ");
            sqlCommand.Append("SurveyGuid, ");
            sqlCommand.Append("PageTitle, ");
            sqlCommand.Append("PageOrder, ");
            sqlCommand.Append("PageEnabled )");

            sqlCommand.Append("SELECT :PageGuid, :SurveyGuid, :PageTitle, ");
            sqlCommand.Append("Count(*), :PageEnabled FROM mp_SurveyPages; ");

            SqliteParameter[] arParams = new SqliteParameter[4];

            arParams[0] = new SqliteParameter(":PageGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = pageGuid.ToString();

            arParams[1] = new SqliteParameter(":SurveyGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = surveyGuid.ToString();

            arParams[2] = new SqliteParameter(":PageTitle", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = pageTitle;

            arParams[3] = new SqliteParameter(":PageEnabled", DbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = intPageEnabled;

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return rowsAffected;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:62,代码来源:DBSurveyPage.cs


示例18: Create

        /// <summary>
        /// Inserts a row in the mp_LetterHtmlTemplate table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="title"> title </param>
        /// <param name="html"> html </param>
        /// <param name="lastModUTC"> lastModUTC </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            string title,
            string html,
            DateTime lastModUTC)
        {
            #region Bit Conversion

            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_LetterHtmlTemplate (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Html, ");
            sqlCommand.Append("LastModUTC )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Html, ");
            sqlCommand.Append(":LastModUTC );");

            SqliteParameter[] arParams = new SqliteParameter[5];

            arParams[0] = new SqliteParameter(":Guid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = guid.ToString();

            arParams[1] = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = siteGuid.ToString();

            arParams[2] = new SqliteParameter(":Title", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = title;

            arParams[3] = new SqliteParameter(":Html", DbType.Object);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = html;

            arParams[4] = new SqliteParameter(":LastModUTC", DbType.DateTime);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = lastModUTC;

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:61,代码来源:DBLetterHtmlTemplate.cs


示例19: Add

        /// <summary>
        /// Inserts a row in the mp_PollOptions table. Returns rows affected count.
        /// </summary>
        /// <param name="optionGuid"> optionGuid </param>
        /// <param name="pollGuid"> pollGuid </param>
        /// <param name="answer"> answer </param>
        /// <param name="votes"> votes </param>
        /// <param name="order"> order </param>
        /// <returns>int</returns>
        public static int Add(
            Guid optionGuid,
            Guid pollGuid,
            string answer,
            int order)
        {
            int votes = 0;

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_PollOptions (");
            sqlCommand.Append("OptionGuid, ");
            sqlCommand.Append("PollGuid, ");
            sqlCommand.Append("Answer, ");
            sqlCommand.Append("Votes, ");
            sqlCommand.Append("[Order] )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":OptionGuid, ");
            sqlCommand.Append(":PollGuid, ");
            sqlCommand.Append(":Answer, ");
            sqlCommand.Append(":Votes, ");
            sqlCommand.Append(":Sort )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[5];

            arParams[0] = new SqliteParameter(":OptionGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = optionGuid.ToString();

            arParams[1] = new SqliteParameter(":PollGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = pollGuid.ToString();

            arParams[2] = new SqliteParameter(":Answer", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = answer;

            arParams[3] = new SqliteParameter(":Votes", DbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = votes;

            arParams[4] = new SqliteParameter(":Sort", DbType.Int32);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = order;

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:59,代码来源:DBPollOption.cs


示例20: Delete

 public void Delete ()
 {
     var connection = NoteDBUtil.CreateConnnection ();
     
     using (var cmd = connection.CreateCommand ()) {
         connection.Open ();
         string sql = "Delete From Note Where [email protected]";
         SqliteParameter idParam = new SqliteParameter ("@id", _id);
         cmd.Parameters.Add (idParam);
         cmd.CommandText = sql;
         cmd.ExecuteNonQuery ();
         connection.Close ();
     }
 }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:14,代码来源:Note.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Sqlite.SqliteStatement类代码示例发布时间:2022-05-26
下一篇:
C# Sqlite.SqliteDataReader类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap