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

C# SqlCeParameter类代码示例

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

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



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

示例1: AccountClearLockout

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0] = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = userGuid;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

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


示例2: AccountLockout

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[2];

            arParams[0] = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = userGuid;

            arParams[1] = new SqlCeParameter("@LastLockoutDate", SqlDbType.DateTime);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = lockoutTime;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return (rowsAffected > -1);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:30,代码来源:DBSiteUser.cs


示例3: GetUserCountByYearMonth

        public DbDataReader GetUserCountByYearMonth(int siteId)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT ");
            sqlCommand.Append("DatePart(year,DateCreated) As Y, ");
            sqlCommand.Append("DatePart(month, DateCreated) As M, ");
            //TODO: this line causes an error, not sure what the solution is in SqlCE
            //sqlCommand.Append("(CONVERT(varchar(10),YEAR(DateCreated)) + '-' + CONVERT(varchar(3),MONTH(DateCreated))) As Label, ");
            sqlCommand.Append("'label' AS Label, ");
            sqlCommand.Append("COUNT(*) As Users ");

            sqlCommand.Append("FROM	mp_Users ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteID = @SiteID ");
            sqlCommand.Append("GROUP BY ");
            sqlCommand.Append("DatePart(year, DateCreated), DatePart(month,DateCreated) ");
            sqlCommand.Append("ORDER BY ");
            sqlCommand.Append("DatePart(year, DateCreated), DatePart(month,DateCreated) ");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0] = new SqlCeParameter("@SiteID", SqlDbType.Int);
            arParams[0].Value = siteId;

            return AdoHelper.ExecuteReader(
                connectionString,
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);
        }
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:31,代码来源:DBSiteUser.cs


示例4: AddInParameter

        public SqlCeParameter AddInParameter(string name, object val, SqlDbType type)
        {
            SqlCeParameter sp = new SqlCeParameter(name, val);
            sp.SqlDbType = type;
            return sp;

        }
开发者ID:nkaluva,项目名称:helper,代码行数:7,代码来源:SqlceHelper.cs


示例5: Main

        static void Main(string[] args)
        {
            SqlCeConnection connection = new SqlCeConnection("data source=D:\\Git\\MTGCardTracker\\Data\\MyDatabase#1.sdf");
            connection.Open();
            string setSQL = "INSERT INTO SETS(Name, Code, ReleaseDate, Border, Type, Block) VALUES ('{1}', '{2}', @ReleaseDate, '{3}', '{4}', '{5}')";
            string cardSQL = "INSERT INTO CARD(Name, CMC, Rarity, Text, Flavor, Layout, MultiverseID, Printing, Names, ManaCost, Colours, SuperTypes, Types, SubTypes, Artist, Number, Power, Toughness, Loyalty, Variations, imageName, watermark, border, rulings, foreignNames, printings) VALUES ('{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}')";
            int cardID = 0;
            int setID = 0;
            var jsd = new JavaScriptSerializer();
            string[] files = Directory.GetFiles("D:\\Git\\mtgjson\\json", "*.json", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                setID++;
                string json = new StreamReader(file).ReadToEnd();
                Set set = jsd.Deserialize<Set>(json);
                SqlCeParameter param = new SqlCeParameter("@ReleaseDate", SqlDbType.DateTime, 32, "ReleaseDate");
                param.Value = set.releaseDate;
                SqlCeCommand setCommand = new SqlCeCommand(String.Format(setSQL, setID, set.name, set.code, set.border, set.type, set.block));
                setCommand.Parameters.Add(param);
                setCommand.Connection = connection;
                setCommand.ExecuteNonQuery();
                foreach (Card card in set.cards)
                {
                    cardID++;

                    SqlCeCommand cardCommand = new SqlCeCommand(String.Format(cardSQL,
                        cardID, card.name.Replace("'", @"\'"), card.cmc, card.rarity, card.text != null ? card.text.Replace("'", @"\'") : null, card.flavor != null ? card.flavor.Replace("'", @"\'") : null, card.layout, card.multiverseid, card.printings, card.names, card.manaCost, card.colors, card.supertypes, card.types, card.subtypes, card.artist, card.number, card.power, card.toughness, card.loyalty, card.variations, card.imageName, card.watermark != null ? card.watermark.Replace("'", @"\'") : null, card.border, "", "", ""));

                    cardCommand.Connection = connection;
                    cardCommand.ExecuteNonQuery();
                }
            }
            connection.Close();
        }
开发者ID:TheWaxMann,项目名称:MTGCardTracker,代码行数:34,代码来源:Class1.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(";");

            SqlCeParameter[] arParams = new SqlCeParameter[2];

            arParams[0] = new SqlCeParameter("@PlayerID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = playerId;

            arParams[1] = new SqlCeParameter("@TrackOrder", SqlDbType.Int);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = trackOrder;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

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


示例7: Delete

        //public static void Delete(string ipFrom, string ipTo)
        //{
        //    string command = "delete top 1 from ip_ranges where ip_from = @ip_from and ip_to = @ip_to";
        //    SqlCeParameter pIpFrom = new SqlCeParameter() { ParameterName = "ip_from", Value = ipFrom, SqlDbType = SqlDbType.NVarChar };
        //    SqlCeParameter pIpTo = new SqlCeParameter() { ParameterName = "ip_to", Value = ipTo, SqlDbType = SqlDbType.NVarChar };
        //    Db.ExequteSqlCommand(command, pIpFrom, pIpTo);
        //}
        public static void Delete(int id)
        {
            string command = "delete ip_ranges where id = @id";
            SqlCeParameter pId = new SqlCeParameter() { ParameterName = "id", Value = id, SqlDbType = SqlDbType.Int };

            Db.ExequteSqlCommand(command, pId);
        }
开发者ID:WakeDown,项目名称:ServiceCollector,代码行数:14,代码来源:IpRange.cs


示例8: 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(";");

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0] = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = moduleId;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return (rowsAffected > -1);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:29,代码来源:DBMediaFile.cs


示例9: Add

        /// <summary>
        /// Inserts a row in the mp_SurveyResponses table. Returns rows affected count.
        /// </summary>
        /// <param name="responseGuid"> responseGuid </param>
        /// <param name="surveyGuid"> surveyGuid </param>
        /// <param name="userId"> userId </param>
        /// <param name="submissionDate"> submissionDate </param>
        /// <param name="annonymous"> annonymous </param>
        /// <param name="complete"> complete </param>
        /// <returns>int</returns>
        public static int Add(
            Guid responseGuid,
            Guid surveyGuid,
            Guid userGuid,
            bool annonymous,
            bool complete)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_SurveyResponses ");
            sqlCommand.Append("(");
            sqlCommand.Append("ResponseGuid, ");
            sqlCommand.Append("SurveyGuid, ");
            //sqlCommand.Append("SubmissionDate, ");
            sqlCommand.Append("Annonymous, ");
            sqlCommand.Append("Complete, ");
            sqlCommand.Append("UserGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@ResponseGuid, ");
            sqlCommand.Append("@SurveyGuid, ");
            //sqlCommand.Append("@SubmissionDate, ");
            sqlCommand.Append("@Annonymous, ");
            sqlCommand.Append("@Complete, ");
            sqlCommand.Append("@UserGuid ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[5];

            arParams[0] = new SqlCeParameter("@ResponseGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = responseGuid;

            arParams[1] = new SqlCeParameter("@SurveyGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = surveyGuid;

            arParams[2] = new SqlCeParameter("@Annonymous", SqlDbType.Bit);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = annonymous;

            arParams[3] = new SqlCeParameter("@Complete", SqlDbType.Bit);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = complete;

            arParams[4] = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = userGuid;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

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


示例10: AddParm

 public void AddParm( string Name, SqlDbType Type, Object Value, ParameterDirection Direction )
 {
     // Add a parameter to a stored procedure.
     SqlCeParameter p = new SqlCeParameter( Name, Type );
     p.Value = Value;
     p.Direction = Direction;
     _Command.Parameters.Add( p );
 }
开发者ID:rogerpence,项目名称:EnumerateFiles,代码行数:8,代码来源:SQLFactory.cs


示例11: GetParameter

 /// <summary>
 ///  获取一个新参数对象
 /// </summary>
 /// <param name="paraName">参数名</param>
 /// <param name="dbType">参数数据类型</param>
 /// <param name="size">参数大小</param>
 /// <returns>特定于数据源的参数对象</returns>
 public override IDataParameter GetParameter(string paraName, System.Data.DbType dbType, int size)
 {
     SqlCeParameter para = new SqlCeParameter();
     para.ParameterName = paraName;
     para.DbType = dbType;
     para.Size = size;
     return para;
 }
开发者ID:eopeter,项目名称:dmelibrary,代码行数:15,代码来源:DMEDb_SqlServerCe.cs


示例12: Save

        public void Save()
        {
            string command = "insert into ip_ranges (ip_from, ip_to, dattim1) values(@ip_from, @ip_to, @dattim1)";
            SqlCeParameter pIpFrom = new SqlCeParameter() { ParameterName = "ip_from", Value = IpFrom, SqlDbType = SqlDbType.NVarChar };
            SqlCeParameter pIpTo = new SqlCeParameter() { ParameterName = "ip_to", Value = IpTo, SqlDbType = SqlDbType.NVarChar };
            SqlCeParameter pDattim1 = new SqlCeParameter() { ParameterName = "dattim1", Value = DateTime.Now, SqlDbType = SqlDbType.DateTime };

            Db.ExequteSqlCommand(command, pIpFrom, pIpTo, pDattim1);
        }
开发者ID:WakeDown,项目名称:ServiceCollector,代码行数:9,代码来源:IpRange.cs


示例13: Create

        /// <summary>
        /// Inserts a row in the mp_IndexingQueue table. Returns new integer id.
        /// </summary>
        /// <param name="indexPath"> indexPath </param>
        /// <param name="serializedItem"> serializedItem </param>
        /// <param name="itemKey"> itemKey </param>
        /// <param name="removeOnly"> removeOnly </param>
        /// <returns>int</returns>
        public static Int64 Create(
            int siteId,
            string indexPath,
            string serializedItem,
            string itemKey,
            bool removeOnly)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_IndexingQueue ");
            sqlCommand.Append("(");
            sqlCommand.Append("SiteID, ");
            sqlCommand.Append("IndexPath, ");
            sqlCommand.Append("SerializedItem, ");
            sqlCommand.Append("ItemKey, ");
            sqlCommand.Append("RemoveOnly ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@SiteID, ");
            sqlCommand.Append("@IndexPath, ");
            sqlCommand.Append("@SerializedItem, ");
            sqlCommand.Append("@ItemKey, ");
            sqlCommand.Append("@RemoveOnly ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[5];

            arParams[0] = new SqlCeParameter("@IndexPath", SqlDbType.NVarChar, 255);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = indexPath;

            arParams[1] = new SqlCeParameter("@SerializedItem", SqlDbType.NText);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = serializedItem;

            arParams[2] = new SqlCeParameter("@ItemKey", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = itemKey;

            arParams[3] = new SqlCeParameter("@RemoveOnly", SqlDbType.Bit);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = removeOnly;

            arParams[4] = new SqlCeParameter("@SiteID", SqlDbType.Int);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = siteId;

            Int64 newId = Convert.ToInt64(SqlHelper.DoInsertGetIdentitiy(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams));

            return newId;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:65,代码来源:DBIndexingQueue.cs


示例14: Add

        public static int Add(
            Guid optionGuid,
            Guid pollGuid,
            string answer,
            int order)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_PollOptions ");
            sqlCommand.Append("(");
            sqlCommand.Append("OptionGuid, ");
            sqlCommand.Append("PollGuid, ");
            sqlCommand.Append("Answer, ");
            sqlCommand.Append("Votes, ");
            sqlCommand.Append("[Order] ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@OptionGuid, ");
            sqlCommand.Append("@PollGuid, ");
            sqlCommand.Append("@Answer, ");
            sqlCommand.Append("@Votes, ");
            sqlCommand.Append("@Order ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[5];

            arParams[0] = new SqlCeParameter("@OptionGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = optionGuid;

            arParams[1] = new SqlCeParameter("@PollGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = pollGuid;

            arParams[2] = new SqlCeParameter("@Answer", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = answer;

            arParams[3] = new SqlCeParameter("@Votes", SqlDbType.Int);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = 0;

            arParams[4] = new SqlCeParameter("@Order", SqlDbType.Int);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = order;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:56,代码来源:DBPollOption.cs


示例15: Add

        public static int Add(
            Guid answerGuid,
            Guid questionGuid,
            Guid responseGuid,
            string answer)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_SurveyQuestionAnswers ");
            sqlCommand.Append("(");
            sqlCommand.Append("AnswerGuid, ");
            sqlCommand.Append("QuestionGuid, ");
            sqlCommand.Append("ResponseGuid, ");
            sqlCommand.Append("Answer, ");
            sqlCommand.Append("AnsweredDate ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@AnswerGuid, ");
            sqlCommand.Append("@QuestionGuid, ");
            sqlCommand.Append("@ResponseGuid, ");
            sqlCommand.Append("@Answer, ");
            sqlCommand.Append("@AnsweredDate ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[5];

            arParams[0] = new SqlCeParameter("@AnswerGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = answerGuid;

            arParams[1] = new SqlCeParameter("@QuestionGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = questionGuid;

            arParams[2] = new SqlCeParameter("@ResponseGuid", SqlDbType.UniqueIdentifier);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = responseGuid;

            arParams[3] = new SqlCeParameter("@Answer", SqlDbType.NText);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = answer;

            arParams[4] = new SqlCeParameter("@AnsweredDate", SqlDbType.DateTime);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = DateTime.UtcNow;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

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


示例16: CreateParameter

 public IDbDataParameter CreateParameter(string name, DbType dbType, int maxLength)
 {
     IDbDataParameter parameter = new SqlCeParameter
                {
                    ParameterName = name,
                    Size = maxLength
                };
     parameter.DbType = dbType;
     return parameter;
 }
开发者ID:basilrormose,项目名称:Simple.Data,代码行数:10,代码来源:SqlCeDbParameterFactory.cs


示例17: CreateParameter

        public IDbDataParameter CreateParameter(string name, DbType dbType, int maxLength)
        {
            IDbDataParameter parameter = new SqlCeParameter
                                             {
                                                 ParameterName = name,
                                                 Size = maxLength
                                             };
            parameter.DbType = dbType;
            return parameter;
        }
开发者ID:rposbo,项目名称:Simple.Data,代码行数:10,代码来源:SqlCeDbParameterFactory.cs


示例18: Add

        public static int Add(
            Guid questionGuid,
            Guid surveyPageGuid,
            string questionText,
            int questionTypeId,
            bool answerIsRequired,
            string validationMessage)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_SurveyQuestions (");
            sqlCommand.Append("QuestionGuid, ");
            sqlCommand.Append("PageGuid, ");
            sqlCommand.Append("QuestionText, ");
            sqlCommand.Append("QuestionTypeId, ");
            sqlCommand.Append("AnswerIsRequired, ");
            sqlCommand.Append("QuestionOrder, ");
            sqlCommand.Append("ValidationMessage) ");
            sqlCommand.Append("SELECT @QuestionGuid, @PageGuid, @QuestionText, ");
            sqlCommand.Append("@QuestionTypeId, @AnswerIsRequired, Count(*), @ValidationMessage ");
            sqlCommand.Append("FROM mp_SurveyPages; ");

            SqlCeParameter[] arParams = new SqlCeParameter[6];

            arParams[0] = new SqlCeParameter("@QuestionGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = questionGuid;

            arParams[1] = new SqlCeParameter("@PageGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = surveyPageGuid;

            arParams[2] = new SqlCeParameter("@QuestionText", SqlDbType.NText);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = questionText;

            arParams[3] = new SqlCeParameter("@QuestionTypeId", SqlDbType.Int);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value = questionTypeId;

            arParams[4] = new SqlCeParameter("@AnswerIsRequired", SqlDbType.Bit);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value = answerIsRequired;

            arParams[5] = new SqlCeParameter("@ValidationMessage", SqlDbType.NVarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value = validationMessage;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:55,代码来源:DBQuestion.cs


示例19: CreateParameter

        public IDbDataParameter CreateParameter(string name, DbType dbType, int maxLength)
        {
             if (dbType == DbType.AnsiStringFixedLength || dbType == DbType.StringFixedLength) maxLength = 0;
             IDbDataParameter parameter = new SqlCeParameter
                                             {
                                                 ParameterName = name,
                                                 Size = maxLength
                                             };
            parameter.DbType = dbType;
            return parameter;
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:11,代码来源:SqlCeDbParameterFactory.cs


示例20: GetBookByBID

 //返回书籍检索结果
 public DataTable GetBookByBID(string BID)
 {
     DBConnectionLayer db = new DBConnectionLayer();
     db.OpenConnection();
     string sql = "select *from tb_book where [email protected]";
     SqlCeParameter[] pms = new SqlCeParameter[]{
         new SqlCeParameter("@bid",BID)
     };
     DataTable dt = db.GetDataTable(sql, pms);
     db.CloseConnection();
     return dt;
 }
开发者ID:runwithwind,项目名称:mini_project_BMS,代码行数:13,代码来源:Query.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SqlCeTransaction类代码示例发布时间:2022-05-24
下一篇:
C# SqlCeEngine类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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