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

C# MySqlDbType类代码示例

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

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



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

示例1: AddParameter

 /// <summary>
 /// Binds a parameter to the command with the given value and type.
 /// </summary>
 /// <param name="parameterName">
 /// The parameter Name.
 /// </param>
 /// <param name="value">
 /// The value.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 public void AddParameter(string parameterName, object value, MySqlDbType type)
 {
     var parameter = new MySqlParameter();
     parameter.ParameterName = parameterName;
     parameter.Value = value;
     this.Command.Parameters.Add(parameter);
 }
开发者ID:JustinAarden,项目名称:CSC,代码行数:19,代码来源:Database.cs


示例2: MySqlParameter

 /// <summary>
 /// Initializes a new instance of the <see cref="MySqlParameter"/> class with the parameter name, the <see cref="MySqlDbType"/>, the size, and the source column name.
 /// </summary>
 /// <param name="parameterName">The name of the parameter to map. </param>
 /// <param name="dbType">One of the <see cref="MySqlDbType"/> values. </param>
 /// <param name="size">The length of the parameter. </param>
 /// <param name="sourceColumn">The name of the source column. </param>
 public MySqlParameter(string parameterName, MySqlDbType dbType, int size, string sourceColumn) : this(parameterName, dbType)
 {
   Size = size;
   Direction = ParameterDirection.Input;
   SourceColumn = sourceColumn;
   SourceVersion = DataRowVersion.Current;
 }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:14,代码来源:MySqlParameter.cs


示例3: MySqlGeometry

    internal MySqlGeometry(MySqlDbType type, Double xValue, Double yValue, int srid)
    {
      this._type = type;
      this._xValue = xValue;
      this._yValue = yValue;      
      this._isNull = false;
      this._srid = srid;
      this._valBinary = new byte[GEOMETRY_LENGTH];

      byte[] sridBinary = BitConverter.GetBytes(srid);

      for (int i = 0; i < sridBinary.Length; i++)
        _valBinary[i] = sridBinary[i];

      long xVal = BitConverter.DoubleToInt64Bits(xValue);
      long yVal = BitConverter.DoubleToInt64Bits(yValue);

      _valBinary[4] = 1;
      _valBinary[5] = 1;
     
      for (int i = 0; i < 8; i++)
        {
          _valBinary[i + 9] = (byte)(xVal & 0xff);
          xVal >>= 8;
        }

      for (int i = 0; i < 8; i++)
      {
        _valBinary[i + 17] = (byte)(yVal & 0xff);
        yVal >>= 8;
      }
    }
开发者ID:yonglehou,项目名称:Pomelo.Data.MySql,代码行数:32,代码来源:MySqlGeometry.cs


示例4: 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


示例5: DbTypeToString

 public string DbTypeToString(MySqlDbType type, int? length)
 {
     string ret;
     if (TypesAsStrings.TryGetValue(type, out ret))
         return ret + (length != null ? "({0})".SFormat((int)length) : "");
     throw new NotImplementedException(Enum.GetName(typeof(MySqlDbType), type));
 }
开发者ID:pfchrono,项目名称:Toaria,代码行数:7,代码来源:IQueryBuilder.cs


示例6: MySqlBinary

 public MySqlBinary(MySqlDbType type, byte[] val)
 {
     this.type = type;
     this.isNull = false;
     this.mValue = val;
     this.IsGuid = false;
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:7,代码来源:MySqlBinary.cs


示例7: 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


示例8: DbTypeToString

		public string DbTypeToString(MySqlDbType type, int? length)
		{
			string ret;
			if (TypesAsStrings.TryGetValue(type, out ret))
				return ret;
			throw new NotImplementedException(Enum.GetName(typeof(MySqlDbType), type));
		}
开发者ID:sliekasirdis79,项目名称:TShock,代码行数:7,代码来源:IQueryBuilder.cs


示例9: SetDSInfo

		internal static void SetDSInfo(DataTable dsTable) {
			string[] strArray = new string[] { "INT", "YEAR", "MEDIUMINT" };
			MySqlDbType[] typeArray = new MySqlDbType[] { MySqlDbType.Int32, MySqlDbType.Year, MySqlDbType.Int24 };
			for (int i = 0; i < strArray.Length; i++) {
				DataRow row = dsTable.NewRow();
				row["TypeName"] = strArray[i];
				row["ProviderDbType"] = typeArray[i];
				row["ColumnSize"] = 0;
				row["CreateFormat"] = strArray[i];
				row["CreateParameters"] = null;
				row["DataType"] = "System.Int32";
				row["IsAutoincrementable"] = typeArray[i] != MySqlDbType.Year;
				row["IsBestMatch"] = true;
				row["IsCaseSensitive"] = false;
				row["IsFixedLength"] = true;
				row["IsFixedPrecisionScale"] = true;
				row["IsLong"] = false;
				row["IsNullable"] = true;
				row["IsSearchable"] = true;
				row["IsSearchableWithLike"] = false;
				row["IsUnsigned"] = false;
				row["MaximumScale"] = 0;
				row["MinimumScale"] = 0;
				row["IsConcurrencyType"] = DBNull.Value;
				row["IsLiteralsSupported"] = false;
				row["LiteralPrefix"] = null;
				row["LiteralSuffix"] = null;
				row["NativeDataType"] = null;
				dsTable.Rows.Add(row);
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:31,代码来源:MySqlInt32.cs


示例10: getParameter

 private static MySqlParameter getParameter(string Name, MySqlDbType Type, object Value)
 {
     MySqlParameter param = new MySqlParameter();
     param.ParameterName = Name;
     param.MySqlDbType = Type;
     param.Value = Value;
     return param;
 }
开发者ID:ssickles,项目名称:archive,代码行数:8,代码来源:Program.cs


示例11: AddParameter

 public MySqlParameter AddParameter(string ParameterName, MySqlDbType type, int size, object value, ParameterDirection direction)
 {
     MySqlParameter param = new MySqlParameter(ParameterName, type, size);
     param.Direction = direction;
     param.Value = value;
     Command.Parameters.Add(param);
     return param;
 }
开发者ID:rew170,项目名称:soomecode,代码行数:8,代码来源:MySqlHelper.cs


示例12: addSqlParam

 public static void addSqlParam(string name, ParameterDirection direction, int size, MySqlDbType type)
 {
     MySqlParameter sqlParam = new MySqlParameter();
     sqlParam.ParameterName = name;
     sqlParam.Direction = direction;
     sqlParam.Size = size;
     sqlParam.MySqlDbType = type;
     sqlParms.Add(sqlParam);
 }
开发者ID:raj963,项目名称:NewClientOnBoarding,代码行数:9,代码来源:DataAccess.cs


示例13: MySqlGeometry

 internal MySqlGeometry(MySqlDbType type, bool isNull)
 {
   this._type = type;
   isNull = true;
   _xValue = 0;
   _yValue = 0;
   _srid = 0;
   _valBinary = null;
   this._isNull = isNull;
 }
开发者ID:Nicholi,项目名称:mysql-connector-net,代码行数:10,代码来源:MySqlGeometry.cs


示例14: AddParameter

 /// <summary>
 /// 增加SQL命令参数
 /// </summary>
 /// <param name="paraName">参数名</param>
 /// <param name="paraValue">参数值</param>
 /// <param name="paraDbType">数据类型</param>
 /// <param name="paraSize">参数长度</param>
 /// <param name="paraDirection">参数类型(in, out, inout)</param>
 /// <returns></returns>
 public static MySqlParameter AddParameter(string paraName, object paraValue, MySqlDbType paraDbType, int paraSize, ParameterDirection paraDirection)
 {
     MySqlParameter par = new MySqlParameter();
     par.ParameterName = paraName;
     par.Value = paraValue;
     par.Direction = paraDirection;
     par.MySqlDbType = paraDbType;
     if (paraSize > 0)
         par.Size = paraSize;
     return par;
 }
开发者ID:julinn,项目名称:LinnStudio,代码行数:20,代码来源:ulMySqlHelper.cs


示例15: MySqlDateTime

		public MySqlDateTime(MySqlDateTime mdt) {
			this.year = mdt.Year;
			this.month = mdt.Month;
			this.day = mdt.Day;
			this.hour = mdt.Hour;
			this.minute = mdt.Minute;
			this.second = mdt.Second;
			this.millisecond = 0;
			this.type = MySqlDbType.DateTime;
			this.isNull = false;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:11,代码来源:MySqlDateTime.cs


示例16: MySqlDateTime

 /// <summary>
 /// Constructs a new <b>MySqlDateTime</b> object by copying the current value of the given object.
 /// </summary>
 /// <param name="mdt">The <b>MySqlDateTime</b> object to copy.</param>
 public MySqlDateTime(MySqlDateTime mdt)
 {
   year = mdt.Year;
   month = mdt.Month;
   day = mdt.Day;
   hour = mdt.Hour;
   minute = mdt.Minute;
   second = mdt.Second;
   millisecond = 0;
   type = MySqlDbType.DateTime;
   isNull = false;
 }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:16,代码来源:MySqlDateTime.cs


示例17: AddParameter

 /// <summary>
 /// Adds a parameter to the parameteres collection of the command object
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="Type"></param>
 /// <param name="Size"></param>
 /// <param name="Value"></param>
 public void AddParameter(string Name, MySqlDbType Type, int Size, object Value)
 {
     try
     {
         Command.Parameters.Add(Name, Type, Size).Value = Value;
         Command.Parameters[Name].Direction = ParameterDirection.Input;
     }
     catch(MySqlException e)
     {
         throw new System.Exception(e.Message, e.InnerException);
     }
 }
开发者ID:rnovak,项目名称:JiTU-CS,代码行数:19,代码来源:BaseEntity.cs


示例18: CreateParam

 private static DbParameter CreateParam(string ParamName, MySqlDbType DbType, int Size, ParameterDirection Direction, object Value)
 {
     DbParameter parameter;
     if (Size > 0)
     {
         parameter = new MySqlParameter(ParamName, DbType, Size);
     }
     else
     {
         parameter = new MySqlParameter(ParamName, DbType);
     }
     parameter.Direction = Direction;
     if ((Direction != ParameterDirection.Output) || (Value != null))
     {
         parameter.Value = Value;
     }
     return parameter;
 }
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:18,代码来源:DbHelperMySQL.cs


示例19: MySqlGeometry

        public MySqlGeometry(MySqlDbType type, byte[] val)
        {
            if (val == null)
            throw new ArgumentNullException("val");

              byte[] buffValue = new byte[val.Length];

              for (int i = 0; i < val.Length; i++)
               buffValue[i] = val[i];

              var xIndex = val.Length == GEOMETRY_LENGTH ? 9 : 5;
              var yIndex = val.Length == GEOMETRY_LENGTH ? 17 : 13;

              _valBinary = buffValue;
              _xValue = BitConverter.ToDouble(val, xIndex);
              _yValue = BitConverter.ToDouble(val, yIndex);
              this._srid = val.Length == GEOMETRY_LENGTH ? BitConverter.ToInt32(val, 0) : 0;
              this._isNull = false;
              this._type = type;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:20,代码来源:MySqlGeometry.cs


示例20: SetDSInfo

    internal static void SetDSInfo(DataTable dsTable)
    {
      var types = new string[] { "DATE", "DATETIME", "TIMESTAMP" };
      var dbtype = new MySqlDbType[] { MySqlDbType.Date, 
        MySqlDbType.DateTime, MySqlDbType.Timestamp };

      // we use name indexing because this method will only be called
      // when GetSchema is called for the DataSourceInformation 
      // collection and then it wil be cached.
      for (var x = 0; x < types.Length; x++)
      {
        var row = dsTable.NewRow();
        row["TypeName"] = types[x];
        row["ProviderDbType"] = dbtype[x];
        row["ColumnSize"] = 0;
        row["CreateFormat"] = types[x];
        row["CreateParameters"] = null;
        row["DataType"] = "System.DateTime";
        row["IsAutoincrementable"] = false;
        row["IsBestMatch"] = true;
        row["IsCaseSensitive"] = false;
        row["IsFixedLength"] = true;
        row["IsFixedPrecisionScale"] = true;
        row["IsLong"] = false;
        row["IsNullable"] = true;
        row["IsSearchable"] = true;
        row["IsSearchableWithLike"] = false;
        row["IsUnsigned"] = false;
        row["MaximumScale"] = 0;
        row["MinimumScale"] = 0;
        row["IsConcurrencyType"] = DBNull.Value;
        row["IsLiteralSupported"] = false;
        row["LiteralPrefix"] = null;
        row["LiteralSuffix"] = null;
        row["NativeDataType"] = null;
        dsTable.Rows.Add(row);
      }
    }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:38,代码来源:MySqlDateTime.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MyStorageDataTypeFlags类代码示例发布时间:2022-05-24
下一篇:
C# MySqlDatabase类代码示例发布时间: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