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

C# MySqlClient.MySqlParameter类代码示例

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

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



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

示例1: Add

 public int Add(Maticsoft.Email.Model.MailConfig model)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("insert into Accounts_MailConfig(");
     builder.Append("UserID,Mailaddress,Username,Password,SMTPServer,SMTPPort,SMTPSSL,POPServer,POPPort,POPSSL)");
     builder.Append(" values (");
     builder.Append("?UserID,?Mailaddress,?Username,?Password,?SMTPServer,?SMTPPort,?SMTPSSL,?POPServer,?POPPort,?POPSSL)");
     builder.Append(";select ??IDENTITY");
     MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("?UserID", MySqlDbType.Int32, 4), new MySqlParameter("?Mailaddress", MySqlDbType.VarChar, 100), new MySqlParameter("?Username", MySqlDbType.VarChar, 50), new MySqlParameter("?Password", MySqlDbType.VarChar, 50), new MySqlParameter("?SMTPServer", MySqlDbType.VarChar, 50), new MySqlParameter("?SMTPPort", MySqlDbType.Int32, 4), new MySqlParameter("?SMTPSSL", MySqlDbType.Int16, 2), new MySqlParameter("?POPServer", MySqlDbType.VarChar, 50), new MySqlParameter("?POPPort", MySqlDbType.Int32, 4), new MySqlParameter("?POPSSL", MySqlDbType.Int16, 2) };
     cmdParms[0].Value = model.UserID;
     cmdParms[1].Value = model.Mailaddress;
     cmdParms[2].Value = model.Username;
     cmdParms[3].Value = model.Password;
     cmdParms[4].Value = model.SMTPServer;
     cmdParms[5].Value = model.SMTPPort;
     cmdParms[6].Value = model.SMTPSSL ? 1 : 0;
     cmdParms[7].Value = model.POPServer;
     cmdParms[8].Value = model.POPPort;
     cmdParms[9].Value = model.POPSSL ? 1 : 0;
     object single = DbHelperMySQL.GetSingle(builder.ToString(), cmdParms);
     if (single == null)
     {
         return 1;
     }
     return Convert.ToInt32(single);
 }
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:26,代码来源:MailConfig.cs


示例2: CountActiveByProduct

        public static int CountActiveByProduct(Guid siteGuid, Guid productGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT  Count(*) ");
            sqlCommand.Append("FROM	sts_MembershipTicket ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteGuid = ?SiteGuid ");
            sqlCommand.Append("AND ProductGuid = ?ProductGuid ");
            sqlCommand.Append("AND OrderStatusGuid = '70443443-f665-42c9-b69f-48cbf011a14b' "); //fulfillable status
            sqlCommand.Append("AND ?CurrentTimeUtc < TIMESTAMPADD(DAY, GracePeriodDays, EndDateUtc) "); //before end of grace period
            sqlCommand.Append(";");

            MySqlParameter[] arParams = new MySqlParameter[3];

            arParams[0] = new MySqlParameter("?SiteGuid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = siteGuid.ToString();

            arParams[1] = new MySqlParameter("?ProductGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = productGuid.ToString();

            arParams[2] = new MySqlParameter("?CurrentTimeUtc", MySqlDbType.DateTime);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = DateTime.UtcNow;

            return Convert.ToInt32(MySqlHelper.ExecuteScalar(
                GetReadConnectionString(),
                sqlCommand.ToString(),
                arParams));
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:31,代码来源:DBMembershipTicket.cs


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

            MySqlParameter[] arParams = new MySqlParameter[2];

            arParams[0] = new MySqlParameter("?TrackOrder", MySqlDbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = trackOrder;

            arParams[1] = new MySqlParameter("?PlayerID", MySqlDbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = playerId;

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);
            return rowsAffected;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:33,代码来源:DBMediaTrack.cs


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

            MySqlParameter[] arParams = new MySqlParameter[1];

            arParams[0] = new MySqlParameter("?ModuleID", MySqlDbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = moduleId;

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);
            return (rowsAffected > 0);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:27,代码来源:DBMediaFile.cs


示例5: fetchCoursebyId

        public static Course fetchCoursebyId(int _courseid)
        {
            dbManager db = new dbManager();
                Course cs = null;

                string sqlCommand;
                MySqlParameter[] param = new MySqlParameter[1];

                param[0] = new MySqlParameter("@courseid", _courseid);

                sqlCommand = "select * from Course where [email protected]";

                DataTable ds = db.fetchRows(sqlCommand, param);

                int i = 0;

                foreach (DataRow dr in ds.Rows)
                {
                    cs = new Course(Convert.ToInt32(dr["courseid"].ToString()),
                                        dr["coursename"].ToString(),
                                        (DateTime)dr["startdate"],
                                        (DateTime)dr["enddate"],
                                        dr["classondays"].ToString(),
                                        (TimeSpan)dr["classstarttime"],
                                        (TimeSpan)dr["classendtime"]);
                    i++;
                }

                return cs;
        }
开发者ID:jainprachi2506,项目名称:MyCloudClassroom,代码行数:30,代码来源:Course.cs


示例6: CreateParameter

 public static MySqlParameter CreateParameter(ParameterDirection direction, string paramName, MySqlDbType dbtype, int size, object value)
 {
     MySqlParameter param = new MySqlParameter(paramName, dbtype, size);
     param.Value = value;
     param.Direction = direction;
     return param;
 }
开发者ID:rew170,项目名称:soomecode,代码行数:7,代码来源:MySqlHelper_static.cs


示例7: queryAll

 public GZScenery queryAll(long gzSceneryID)
 {
     conn.Open();
     GZScenery gzScenery = new GZScenery();
     string sql = "select * from gzScenery where gzSceneryID = ?gzSceneryID";
     MySqlCommand cmd = new MySqlCommand(sql, conn);
     MySqlParameter[] parameters = new MySqlParameter[1];
     parameters[0] = new MySqlParameter("?gzSceneryID", MySqlDbType.Int64);
     parameters[0].Value = gzSceneryID;
     cmd.Parameters.AddRange(parameters);
     MySqlDataReader reader = cmd.ExecuteReader();
     reader.Read();
     gzScenery.GZSceneryLinePlay = reader[1].ToString();
     gzScenery.GZSceneryIntroduce = reader[2].ToString();
     gzScenery.GZSceneryName = reader[3].ToString();
     gzScenery.GZSceneryCity = reader[4].ToString();
     gzScenery.GZSceneryDateTime = reader[5].ToString();
     gzScenery.GZSceneryTripDay = reader[6].ToString();
     gzScenery.GZSceneryAdultPrice = reader[7].ToString();
     gzScenery.GZSceneryChildren = reader[8].ToString();
     gzScenery.GZScenerySingleRoom = reader[9].ToString();
     gzScenery.GZSceneryTravelDetails = reader[10].ToString();
     gzScenery.GZSceneryGridInformation = reader[11].ToString();
     gzScenery.GZSceneryCost = reader[12].ToString();
     return gzScenery;
 }
开发者ID:GUIZHOUET,项目名称:ET04,代码行数:26,代码来源:GZSceneryDAO.cs


示例8: GetSiteSettingsExList

        public DbDataReader GetSiteSettingsExList(int siteId)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT  e.* ");

            sqlCommand.Append("FROM	mp_SiteSettingsEx e ");

            sqlCommand.Append("JOIN ");
            sqlCommand.Append("mp_SiteSettingsExDef d ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("e.KeyName = d.KeyName ");
            sqlCommand.Append("AND e.GroupName = d.GroupName ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("e.SiteID = ?SiteID ");

            sqlCommand.Append("ORDER BY d.GroupName, d.SortOrder ");
            sqlCommand.Append(";");

            MySqlParameter[] arParams = new MySqlParameter[1];

            arParams[0] = new MySqlParameter("?SiteID", MySqlDbType.Int32);
            arParams[0].Value = siteId;

            return AdoHelper.ExecuteReader(
                readConnectionString,
                sqlCommand.ToString(),
                arParams);

        }
开发者ID:freemsly,项目名称:cloudscribe,代码行数:30,代码来源:DBSiteSettingsEx.cs


示例9: queryLevelReplies

 public List<LevelReplies> queryLevelReplies(long postID)
 {
     sqlconn.Open();
       List<LevelReplies> levelRepliesList = new List<LevelReplies>();
       string sql = "select * from levelReplies where postID=?postID";
       MySqlCommand cmd = new MySqlCommand(sql, sqlconn);
       MySqlParameter[] parameters = new MySqlParameter[1];
       parameters[0] = new MySqlParameter("?postID", MySqlDbType.Int64);
       parameters[0].Value = postID;
       cmd.Parameters.AddRange(parameters);
       MySqlDataReader reader = cmd.ExecuteReader();
       while (reader.Read())
       {
           LevelReplies levelReplies = new LevelReplies();
           levelReplies.LevelRepliesID = Convert.ToInt64(reader[0]);
           levelReplies.PostID = Convert.ToInt64(reader[1]);
           levelReplies.FirstRepliesID = Convert.ToInt64(reader[2]);
           levelReplies.UserName = reader[3].ToString();
           levelReplies.ToUserName = reader[4].ToString();
           levelReplies.Content = reader[5].ToString();
           levelReplies.Time = reader[6].ToString();
           levelRepliesList.Add(levelReplies);
       }
       reader.Close();
       sqlconn.Close();
       return levelRepliesList;
 }
开发者ID:GUIZHOUET,项目名称:ET04,代码行数:27,代码来源:LevelRepliesDAO.cs


示例10: query

        private HassiumObject query(HassiumObject[] args)
        {
            MySqlCommand command = new MySqlCommand(null, Value);
            command.CommandText = "INSERT INTO " + args[0] + "(";
            HassiumObject[] vals = ((HassiumArray)args[1]).Value;
            command.CommandText += vals[0].ToString();
            for (int x = 1; x < vals.Length; x++)
                command.CommandText += ", " + vals[x].ToString();
            command.CommandText += ") VALUES (";
            command.CommandText += "@" + vals[0].ToString();
            for (int x = 1; x < vals.Length; x++)
            command.CommandText += ", @" + vals[x].ToString();
            command.CommandText += ")";

            HassiumObject[] lits = ((HassiumArray)args[2]).Value;
            for (int x = 0; x < lits.Length; x++) {
            MySqlParameter param = new MySqlParameter("@" + vals[x].ToString(), lits[x].ToString());
            param.Value = lits[x].ToString();
            command.Parameters.Add(param);
            }
            // Console.WriteLine(command.CommandText);

            command.Prepare();
            command.ExecuteNonQuery();

            return null;
        }
开发者ID:HassiumTeam,项目名称:HassiumModules,代码行数:27,代码来源:HassiumSql.cs


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

            MySqlParameter[] arParams = new MySqlParameter[3];

            arParams[0] = new MySqlParameter("?LoginProvider", MySqlDbType.VarChar, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value = loginProvider;

            arParams[1] = new MySqlParameter("?ProviderKey", MySqlDbType.VarChar, 128);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value = providerKey;

            arParams[2] = new MySqlParameter("?UserId", MySqlDbType.VarChar, 128);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value = userId;

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);
            return (rowsAffected > 0);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:33,代码来源:DBUserLogins.cs


示例12: DeleteCategorie

        public void DeleteCategorie(int categorie_id)
        {
            try
            {
                conn.Open();

                string insertString = @"delete from categorie where [email protected]_id";
                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter sportParam = new MySqlParameter("@categorie_id", MySqlDbType.Int32);

                sportParam.Value = categorie_id;

                cmd.Parameters.Add(sportParam);

                cmd.Prepare();

                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                Console.Write("categorie niet verwijderd: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
开发者ID:CVD95,项目名称:WebshopDierenwinkel,代码行数:28,代码来源:CategorieDBController.cs


示例13: MakeParam

        ///<summary>
        ///</summary>
        ///<param name="paramName"></param>
        ///<param name="dbType"></param>
        ///<param name="size"></param>
        ///<param name="direction"></param>
        ///<param name="value"></param>
        ///<returns></returns>
        ///<exception cref="ArgumentOutOfRangeException"></exception>
        public static MySqlParameter MakeParam(string paramName, MySqlDbType dbType, int size, ParameterDirection direction, object value)
        {
            MySqlParameter sqlParameter = null;
            try
            {
                paramName = paramName ?? string.Empty;

                //modify reason:验证花时比较大
                //if (!MathUtils.IsMachVarName(paramName))
                //{
                //    throw new ArgumentOutOfRangeException("paramName", "参数名格式不正确");
                //}
                if (size > 0)
                {
                    sqlParameter = new MySqlParameter(FormatParamName(paramName), dbType, size);
                }
                else
                {
                    sqlParameter = new MySqlParameter(FormatParamName(paramName), dbType);
                }
                sqlParameter.Direction = direction;
                if (direction != ParameterDirection.Output || value != null)
                {
                    sqlParameter.Value = value;
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("{0}", ex);
            }
            return sqlParameter;
        }
开发者ID:huangchenjun,项目名称:Scut,代码行数:41,代码来源:MySqlParamHelper.cs


示例14: DeleteInschrijving

        public void DeleteInschrijving(int studentID, int evenementID)
        {
            MySqlTransaction trans = null;
            try
            {
                conn.Open();
                trans = conn.BeginTransaction();
                string insertString = @"delete from inschrijving where [email protected] and [email protected]";

                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter studentidParam = new MySqlParameter("@studentid", MySqlDbType.Int32);
                MySqlParameter evenementidParam = new MySqlParameter("@evenementid", MySqlDbType.Int32);

                studentidParam.Value = studentID;
                evenementidParam.Value = evenementID;

                cmd.Parameters.Add(studentidParam);
                cmd.Parameters.Add(evenementidParam);
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                trans.Commit();

            }
            catch (Exception e)
            {
                trans.Rollback();
                Console.Write("Inschrijving niet verwijderd: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
开发者ID:CVD95,项目名称:WebshopDierenwinkel,代码行数:35,代码来源:InschrijvingDBController.cs


示例15: RunSqlQueryWithReturnId

        private static void RunSqlQueryWithReturnId(string queryText, Dictionary<string, object> parametters, CommandType commandType, Action<int> action)
        {
            using (MySqlConnection oConn = new MySqlConnection(dbSetting.Default.MySqlConnectionString))
            {
                using (MySqlCommand oRS = oConn.CreateCommand())
                {
                    oConn.Open();
                    oRS.CommandType = commandType;
                    oRS.CommandText = queryText;
                    if (parametters != null && parametters.Count > 0)
                    {
                        foreach (var parametter in parametters)
                        {
                            oRS.Parameters.AddWithValue(parametter.Key, parametter.Value);
                        }
                    }

                    // output parameters
                    MySqlParameter param = new MySqlParameter("@ID", MySqlDbType.Int16);
                    param.Direction = ParameterDirection.Output;
                    oRS.Parameters.Add(param);

                    oRS.ExecuteNonQuery();

                    if (action != null)
                    {
                        action(int.Parse(oRS.LastInsertedId.ToString()));
                    }
                }
            }
        }
开发者ID:BorisPenev,项目名称:TelerikAkademy,代码行数:31,代码来源:MySqlProvider.cs


示例16: efetuarLogin

        public void efetuarLogin()
        {
            MySqlConnection con = new MySqlConnection(Form1.conexao);
            con.Open();
            MySqlCommand comando = new MySqlCommand("Select id,fcNomeAcesso,fcSenha,fcLoja from ubfuncionario where fcNomeAcesso =?Nome and fcSenha =?Senha and fcLoja=?Loja");
            comando.Connection = con;

            MySqlParameter Parametros = new MySqlParameter();

            comando.Parameters.AddWithValue("?Senha", txtSenha.Text);
            comando.Parameters.AddWithValue("?Loja", cbLojas.SelectedValue);
            comando.Parameters.AddWithValue("?Nome", txtUsuario.Text);

            MySqlDataAdapter daLogin = new MySqlDataAdapter(comando);
            DataTable dtLogin = new DataTable();
            daLogin.Fill(dtLogin);
            try
            {
                idLoja = Int32.Parse(dtLogin.Rows[0][3].ToString());
                idUsuario = Int32.Parse(dtLogin.Rows[0][0].ToString());
                lblStatus.Text = "LOGIN EFETUADO!";
                lblStatus.ForeColor = System.Drawing.Color.Green;

                for (int i = 231; i <= 483; i += 50)
                {
                    this.Width = i;
                }
            }
            catch
            {

                lblStatus.Text ="USUÁRIO INEXISTENTE!";
            }
        }
开发者ID:ViniciusConsultor,项目名称:teiateste,代码行数:34,代码来源:login.cs


示例17: InsertCar

        public void InsertCar(Car o)
        {
            StringBuilder sb = new StringBuilder("insert into Car (Make, Model, Year, Doors, Colour, Price) values ")
            .Append("(@make, @model, @year, @doors, @colour, @price)");
            string q = sb.ToString();

            using (MySqlCommand cm = new MySqlCommand(q, Connection))
            {
                MySqlParameter p = new MySqlParameter("@make", MySqlDbType.String);
                p.Value = o.Make;
                cm.Parameters.Add(p);

                p = new MySqlParameter("@model", MySqlDbType.String);
                p.Value = o.Model;
                cm.Parameters.Add(p);

                p = new MySqlParameter("@year", MySqlDbType.Int32);
                p.Value = o.Year;
                cm.Parameters.Add(p);

                p = new MySqlParameter("@doors", MySqlDbType.Int32);
                p.Value = o.Doors;
                cm.Parameters.Add(p);

                p = new MySqlParameter("@colour", MySqlDbType.String);
                p.Value = o.Colour;
                cm.Parameters.Add(p);

                p = new MySqlParameter("@price", MySqlDbType.Double);
                p.Value = o.Price;
                cm.Parameters.Add(p);

                cm.ExecuteNonQuery();
            }
        }
开发者ID:wfsiew,项目名称:WcfApp,代码行数:35,代码来源:DbLayer.cs


示例18: GetUserCountByYearMonth

        public DbDataReader GetUserCountByYearMonth(int siteId)
        {
            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT ");
            sqlCommand.Append("YEAR(DateCreated) As Y,  ");
            sqlCommand.Append("MONTH(DateCreated) As M, ");
            sqlCommand.Append("CONCAT(YEAR(DateCreated), '-', MONTH(DateCreated)) As Label, ");
            sqlCommand.Append("COUNT(*) As Users ");

            sqlCommand.Append("FROM ");
            sqlCommand.Append("mp_Users ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteID = ?SiteID ");
            sqlCommand.Append("GROUP BY YEAR(DateCreated), MONTH(DateCreated) ");
            sqlCommand.Append("ORDER BY YEAR(DateCreated), MONTH(DateCreated) ");
            sqlCommand.Append("; ");


            MySqlParameter[] arParams = new MySqlParameter[1];

            arParams[0] = new MySqlParameter("?SiteID", MySqlDbType.Int32);
            arParams[0].Value = siteId;

            return AdoHelper.ExecuteReader(
                readConnectionString,
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

        }
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:30,代码来源:DBSiteUser.cs


示例19: DeleteGenre

        public void DeleteGenre(int genreId)
        {
            MySqlTransaction trans = null;
            try
            {
                conn.Open();
                trans = conn.BeginTransaction();
                string insertString = @"delete from genre where [email protected]";

                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter idParam = new MySqlParameter("@id", MySqlDbType.Int32);
                idParam.Value = genreId;

                cmd.Parameters.Add(idParam);
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                trans.Commit();

            }
            catch (Exception e)
            {
                trans.Rollback();
                Console.Write("Genre niet verwijderd: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
开发者ID:CVD95,项目名称:WebshopDierenwinkel,代码行数:31,代码来源:GenreController.cs


示例20: AnnulerenBestelling

        public void AnnulerenBestelling(int bestellingscode)
        {
            try
            {
                conn.Open();

                string insertString = @"UPDATE factuur " +
                                        "SET [email protected] " +
                                         "WHERE [email protected]_code";

                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter bestellingscodeParam = new MySqlParameter("@factuur_code", MySqlDbType.Int32);
                MySqlParameter statusParam = new MySqlParameter("@status", MySqlDbType.Enum);

                bestellingscodeParam.Value = bestellingscode;
                statusParam.Value = "Geannulleerd";

                cmd.Parameters.Add(bestellingscodeParam);
                cmd.Parameters.Add(statusParam);

                cmd.Prepare();
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                Console.Write("Updaten bestelling niet gelukt: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
开发者ID:CVD95,项目名称:WebshopDierenwinkel,代码行数:33,代码来源:BestellingDBController.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MySqlClient.MySqlSchemaCollection类代码示例发布时间:2022-05-26
下一篇:
C# MySqlClient.MySqlPacket类代码示例发布时间: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