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


C# Odbc.OdbcParameter类代码示例

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


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

示例1: inserir

 public int inserir(Voos voo)
 {
     OdbcCommand comando;
     int result = 0;
     String comand = "INSERT INTO voo(codigo, data, origem, destino) VALUES(?, ?, ?, ?)";
     OdbcParameter codigo = new OdbcParameter("?", voo.Codigo);
     OdbcParameter data = new OdbcParameter("?", voo.Data);
     OdbcParameter origem = new OdbcParameter("?", voo.Origem);
     OdbcParameter destino = new OdbcParameter("?", voo.Destino);
     try
     {
         comando = new OdbcCommand(comand, conexao);
         comando.Connection.Open();
         comando.Parameters.Add(codigo);
         comando.Parameters.Add(data);
         comando.Parameters.Add(origem);
         comando.Parameters.Add(destino);
         result = comando.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         conexao.Close();
     }
     return result;
 }
开发者ID:abnermsantos,项目名称:CompanhiaAerea,代码行数:29,代码来源:VoosDAO.cs

示例2: inserir

 public int inserir(Aviao aviao)
 {
     OdbcCommand comando;
     int result = 0;
     String comand = "INSERT INTO aviao(numeroSerie, modelo) VALUES(?, ?)";
     OdbcParameter numeroSerie = new OdbcParameter("?", aviao.NumeroSerie);
     OdbcParameter modelo = new OdbcParameter("?", aviao.Modelo);
     try
     {
         comando = new OdbcCommand(comand, conexao);
         comando.Connection.Open();
         comando.Parameters.Add(numeroSerie);
         comando.Parameters.Add(modelo);
         result = comando.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         conexao.Close();
     }
     return result;
 }
开发者ID:abnermsantos,项目名称:CompanhiaAerea,代码行数:25,代码来源:AviaoDAO.cs

示例3: Execute

        /// <summary>
        /// ����
        /// </summary>
        /// <param name="sql"></param>
        public static int Execute(string sql, string connstr, OdbcParameter[] parameters)
        {
            int n = -1;
            OdbcConnection conn = null;
            try
            {
                conn = GetConnection(connstr);
                OdbcCommand cmd = new OdbcCommand();//sql, conn);
                cmd.CommandText = sql;
                cmd.Connection = conn;
                for (int i = 0; i < parameters.Length; i++)
                {
                    cmd.Parameters.AddWithValue(parameters[i].ParameterName, parameters[i].Value);
                }
                conn.Open();
                n = cmd.ExecuteNonQuery();

            }
            catch (Exception e)
            {
                //MessageBox.Show( sql, "ϵͳ�����������Ա��ϵ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw new DatabaseException(sql + "\n" + e.Message);
            }
            finally
            {
                try { conn.Close(); }
                catch { }
            }
            conn = null;
            return n;
        }
开发者ID:PeterLiuJF,项目名称:ProgrammerHome,代码行数:35,代码来源:OdbcModel.cs

示例4: add_parameter

 public void add_parameter(long value)
 {
     OdbcParameter param = new OdbcParameter();
     param.DbType = DbType.Int64;
     param.Value = value;
     _parameters.Add(param);
 }
开发者ID:Mrknister,项目名称:MUDEngine,代码行数:7,代码来源:BasicSqlExecuter.cs

示例5: inserir

 public int inserir(Cliente cliente)
 {
     OdbcCommand comando;
     int result = 0;
     String comand = "INSERT INTO cliente(nome, cpf, cidade) VALUES(?, ?, ?)";
     OdbcParameter nome = new OdbcParameter("?", cliente.Nome);
     OdbcParameter cpf = new OdbcParameter("?", cliente.Cpf);
     OdbcParameter cidade = new OdbcParameter("?", cliente.Cidade);
     try
     {
         comando = new OdbcCommand(comand, conexao);
         comando.Connection.Open();
         comando.Parameters.Add(nome);
         comando.Parameters.Add(cpf);
         comando.Parameters.Add(cidade);
         result = comando.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         conexao.Close();
     }
     return result;
 }
开发者ID:abnermsantos,项目名称:CompanhiaAerea,代码行数:27,代码来源:ClienteDAO.cs

示例6: inserir

 public int inserir(Aeroportos aeroporto)
 {
     OdbcCommand comando;
     int result = 0;
     String comand = "INSERT INTO aeroporto(nome, cidade, codigo) VALUES(?, ?, ?)";
     OdbcParameter nome = new OdbcParameter("?", aeroporto.Nome);
     OdbcParameter cidade = new OdbcParameter("?", aeroporto.Cidade);
     OdbcParameter codigo = new OdbcParameter("?", aeroporto.Codigo);
     try
     {
         comando = new OdbcCommand(comand, conexao);
         comando.Connection.Open();
         comando.Parameters.Add(nome);
         comando.Parameters.Add(cidade);
         comando.Parameters.Add(codigo);
         result = comando.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         conexao.Close();
     }
     return result;
 }
开发者ID:abnermsantos,项目名称:CompanhiaAerea,代码行数:27,代码来源:AeroportoDAO.cs

示例7: GetParametroRetorno

        /// <summary>
        /// Sobrescreve o metodo de Paramatro Retorno,adiciona o parametro de "@RETURN_VALUE".
        /// </summary>
        /// <returns>Retorna uma colecao de parametros com o parametro "@RETURN_VALUE" </returns>
        internal override IDataParameter GetParametroRetorno()
        {
            OdbcParameter p = new OdbcParameter("@RETURN_VALUE",OdbcType.Int);
            p.Direction = ParameterDirection.ReturnValue;

            return p;
        }
开发者ID:Altamontanha,项目名称:altamontanha,代码行数:11,代码来源:ConexaoOdbc.cs

示例8: inserir

 public int inserir(Reservas reserva)
 {
     OdbcCommand comando;
     int result = 0;
     String comand = "INSERT INTO reserva(voo, assento, cpf_cliente) VALUES(?, ?, ?)";
     OdbcParameter voo = new OdbcParameter("?", reserva.Voo);
     OdbcParameter assento = new OdbcParameter("?", reserva.Assento);
     OdbcParameter cpf = new OdbcParameter("?", reserva.Cpf_cliente);
     try
     {
         comando = new OdbcCommand(comand, conexao);
         comando.Connection.Open();
         comando.Parameters.Add(voo);
         comando.Parameters.Add(assento);
         comando.Parameters.Add(cpf);
         result = comando.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     finally
     {
         conexao.Close();
     }
     return result;
 }
开发者ID:abnermsantos,项目名称:CompanhiaAerea,代码行数:27,代码来源:ReservasDAO.cs

示例9: GetParameter

 /// <summary>
 ///  ��ȡһ���²�������
 /// </summary>
 /// <param name="paraName">������</param>
 /// <param name="dbType">������������</param>
 /// <param name="size">������С</param>
 /// <returns>�ض�������Դ�IJ�������</returns>
 public override IDataParameter GetParameter(string paraName,System.Data.DbType dbType,int size)
 {
     OdbcParameter para=new OdbcParameter();
     para.ParameterName=paraName;
     para.DbType=dbType;
     para.Size=size;
     return para;
 }
开发者ID:eopeter,项目名称:dmelibrary,代码行数:15,代码来源:DMEDb_ODBC.cs

示例10: OdbcParameter

 private OdbcParameter(OdbcParameter source) : this()
 {
     ADP.CheckArgumentNull(source, "source");
     source.CloneHelper(this);
     ICloneable cloneable = this._value as ICloneable;
     if (cloneable != null)
     {
         this._value = cloneable.Clone();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:OdbcParameter.cs

示例11: CreateParameter

 /// <summary>
 /// 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="dbType"></param>
 /// <returns></returns>
 public override DbParameter CreateParameter(string name, Enum dbType, byte? precision, byte? scale)
 {
     if (dbType is OdbcType)
     {
         var p = new OdbcParameter(name, (OdbcType)dbType);
         if (precision.HasValue == true) p.Precision = precision.Value;
         if (scale.HasValue == true) p.Scale = scale.Value;
         return p;
     }
     throw new ArgumentException("dbType must be OdbcType.");
 }
开发者ID:fengweijp,项目名称:higlabo,代码行数:17,代码来源:OdbcDatabase.cs

示例12: MakeParam

        public DbParameter MakeParam(string ParamName, DbType DbType, Int32 Size)
        {
            OdbcParameter param;

            if (Size > 0)
                param = new OdbcParameter(ParamName, (OdbcType)DbType, Size);
            else
                param = new OdbcParameter(ParamName, (OdbcType)DbType);

            return param;
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:11,代码来源:OdbcProvider.cs

示例13: AddParameter

 protected void AddParameter(string key, string val, int value)
 {
     if (lstDbParameters == null)
     {
         lstDbParameters = new List<DbParameter>();
     }
     OdbcParameter oParam = new OdbcParameter();
     oParam.ParameterName = key;
     oParam.Value = val;
     lstDbParameters.Add(oParam);
 }
开发者ID:MumbaiHackerspace,项目名称:HelpingMunicipality,代码行数:11,代码来源:ParentData.cs

示例14: OdbcParameter

 public override DbParameter CréerDBParameter()
 {
     if (this.options.ConnexionODBC == true)
     {
         OdbcParameter param = new OdbcParameter();
         return param;
     }
     else
     {
         SqlParameter param = new SqlParameter();
         return param;
     }
 }
开发者ID:EricMinso,项目名称:ImportExport,代码行数:13,代码来源:ConnexionSQLServer.cs

示例15: ConvertToNativeParameter

        private static IDbDataParameter ConvertToNativeParameter(DbParameter dbParameter)
        {
            IDbDataParameter clone = new OdbcParameter();
            ((OdbcParameter)clone).IsNullable = dbParameter.IsNullable;
            clone.ParameterName = parameterRenderer.RenderParameterName(dbParameter);

            clone.DbType = dbParameter.DbType;
            clone.Direction = dbParameter.Direction;
            clone.Precision = dbParameter.Precision;
            clone.Scale = dbParameter.Scale;
            clone.Size = dbParameter.Size;
            clone.SourceColumn = dbParameter.SourceColumn;
            clone.SourceVersion = dbParameter.SourceVersion;
            clone.Value = dbParameter.Value;

            return clone;
        }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:17,代码来源:OdbcCommandBuilder.cs


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