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


C# OleDb.OleDbDataReader类代码示例

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


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

示例1: PipeDataAdapter

        public PipeDataAdapter(OleDbDataReader dr, string workSheetName, int rowNumber)
        {
            //setting parts via a data reader
            ErrorMessages = new List<string>();

            AreaNumber = string.Empty;
            SequenceNumber =string.Empty;
            Class = string.Empty;
            Size = string.Empty;
            FluidCode = string.Empty;
            SpecialFeature =string.Empty;
            PandID = string.Empty;
            From = string.Empty;
            To = string.Empty;
            Category = string.Empty;
            Description = string.Empty;

            mRowNumber = rowNumber;
            mWorkSheetName = workSheetName;

            AreaNumber = dr.SafeString((int)PipeColumn.Area);
            SequenceNumber = dr.SafeString((int)PipeColumn.Sequence);
            Class = dr.SafeString((int)PipeColumn.PipeClass);
            Size = dr.SafeString((int)PipeColumn.Size);
            FluidCode = dr.SafeString((int)PipeColumn.FluidCode);
            SpecialFeature = dr.SafeString((int)PipeColumn.SpecialFeature);

            PandID = dr.SafeString((int)PipeColumn.PID);
            From = dr.SafeString((int)PipeColumn.From);
            To = dr.SafeString((int)PipeColumn.To);
            Category = dr.SafeString((int)PipeColumn.Category);
            Description = dr.SafeString((int)PipeColumn.Description);
            IsActive = dr.SafeNullableBool((int) PipeColumn.IsActive);
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:34,代码来源:PipeDataAdapter.cs

示例2: SignalAttributeMasterBean

 public SignalAttributeMasterBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_SIGNAL_ATTRIBUTE_ID) )
         fieldMap[_SIGNAL_ATTRIBUTE_ID] = reader[_SIGNAL_ATTRIBUTE_ID];
     else
         fieldMap.Add(_SIGNAL_ATTRIBUTE_ID, reader[_SIGNAL_ATTRIBUTE_ID]);
     if( fieldMap.ContainsKey(_SIGNAL_ID) )
         fieldMap[_SIGNAL_ID] = reader[_SIGNAL_ID];
     else
         fieldMap.Add(_SIGNAL_ID, reader[_SIGNAL_ID]);
     if( fieldMap.ContainsKey(_ATTRIBUTE_NAME) )
         fieldMap[_ATTRIBUTE_NAME] = reader[_ATTRIBUTE_NAME];
     else
         fieldMap.Add(_ATTRIBUTE_NAME, reader[_ATTRIBUTE_NAME]);
     if( fieldMap.ContainsKey(_DEFAULT_VALUE) )
         fieldMap[_DEFAULT_VALUE] = reader[_DEFAULT_VALUE];
     else
         fieldMap.Add(_DEFAULT_VALUE, reader[_DEFAULT_VALUE]);
     if( fieldMap.ContainsKey(_TYPE) )
         fieldMap[_TYPE] = reader[_TYPE];
     else
         fieldMap.Add(_TYPE, reader[_TYPE]);
     if( fieldMap.ContainsKey(_FIXED_VALUE) )
         fieldMap[_FIXED_VALUE] = reader[_FIXED_VALUE];
     else
         fieldMap.Add(_FIXED_VALUE, reader[_FIXED_VALUE]);
     initialize();
 }
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:29,代码来源:SignalAttributeMasterBean.cs

示例3: loadData

 public void loadData()
 {
     try
     {
         lvexaminee.Items.Clear();
         //OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=db.accdb");
         conn.Open();
         OleDbCommand cmd = new OleDbCommand("SELECT * FROM examineetbl", conn);
         OleDbDataReader dr;
         dr = cmd.ExecuteReader();
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 lvexaminee.Items.Add(dr[0].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[1].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[2].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[3].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[4].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[8].ToString());
             }
         }
         dr.Close();
         conn.Close();
     }
     catch (OleDbException ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
开发者ID:keitz14,项目名称:EntranceExam,代码行数:31,代码来源:ExamineeForm.cs

示例4: VendorDataAdapter

        public VendorDataAdapter(OleDbDataReader dr, int rowNumber)
        {
            ErrorMessages = new List<string>();

            //Name
            Name = dr.SafeString((int)VendorColumn.VendorName);
            if (String.IsNullOrEmpty(Name))
            {
                ErrorMessages.Add(string.Format("{0} returned null, please check the format of this cell in Excel (set to Text). Row number '{1}'. Skipping ", VendorColumn.VendorName, rowNumber));
            }

            //Number
            string numberString = string.Empty;
            numberString = dr.SafeString((int)VendorColumn.VendorNumber);
            int number;

            if (int.TryParse(numberString, out number))
            {
                Number = number;
            }
            else
            {
                ErrorMessages.Add(string.Format("Could not convert {0} '{1}' to number. Rown number '{2}'. Skipping ", VendorColumn.VendorNumber, numberString, rowNumber));
            }

            //City
            City = dr.SafeString((int)VendorColumn.VendorCity);
            if (String.IsNullOrEmpty(City))
            {
                ErrorMessages.Add(string.Format("{0} returned null, please check the format of this cell in Excel (set to Text). Row number '{1}'. Skipping ", VendorColumn.VendorCity, rowNumber));
            }
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:32,代码来源:VendorDataAdapter.cs

示例5: InstrumentBean

 public InstrumentBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_INSTRUMENT_UUID) )
         fieldMap[_INSTRUMENT_UUID] = reader[_INSTRUMENT_UUID];
     else
         fieldMap.Add(_INSTRUMENT_UUID, reader[_INSTRUMENT_UUID]);
     if( fieldMap.ContainsKey(_INSTRUMENT_NAME) )
         fieldMap[_INSTRUMENT_NAME] = reader[_INSTRUMENT_NAME];
     else
         fieldMap.Add(_INSTRUMENT_NAME, reader[_INSTRUMENT_NAME]);
     if( fieldMap.ContainsKey(_MODEL_NAME) )
         fieldMap[_MODEL_NAME] = reader[_MODEL_NAME];
     else
         fieldMap.Add(_MODEL_NAME, reader[_MODEL_NAME]);
     if( fieldMap.ContainsKey(_ATML) )
         fieldMap[_ATML] = reader[_ATML];
     else
         fieldMap.Add(_ATML, reader[_ATML]);
     if( fieldMap.ContainsKey(_DESCRIPTION) )
         fieldMap[_DESCRIPTION] = reader[_DESCRIPTION];
     else
         fieldMap.Add(_DESCRIPTION, reader[_DESCRIPTION]);
     if( fieldMap.ContainsKey(_PART_NUMBER) )
         fieldMap[_PART_NUMBER] = reader[_PART_NUMBER];
     else
         fieldMap.Add(_PART_NUMBER, reader[_PART_NUMBER]);
     initialize();
 }
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:29,代码来源:InstrumentBean.cs

示例6: TestSignalLibraryBean

 public TestSignalLibraryBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_ID) )
         fieldMap[_ID] = reader[_ID];
     else
         fieldMap.Add(_ID, reader[_ID]);
     if( fieldMap.ContainsKey(_LIBRARY_NAME) )
         fieldMap[_LIBRARY_NAME] = reader[_LIBRARY_NAME];
     else
         fieldMap.Add(_LIBRARY_NAME, reader[_LIBRARY_NAME]);
     if( fieldMap.ContainsKey(_CONTENT) )
         fieldMap[_CONTENT] = reader[_CONTENT];
     else
         fieldMap.Add(_CONTENT, reader[_CONTENT]);
     if( fieldMap.ContainsKey(_FILE_NAME) )
         fieldMap[_FILE_NAME] = reader[_FILE_NAME];
     else
         fieldMap.Add(_FILE_NAME, reader[_FILE_NAME]);
     if( fieldMap.ContainsKey(_LAST_UPDATE) )
         fieldMap[_LAST_UPDATE] = reader[_LAST_UPDATE];
     else
         fieldMap.Add(_LAST_UPDATE, reader[_LAST_UPDATE]);
     if( fieldMap.ContainsKey(_TARGET_NAMESPACE) )
         fieldMap[_TARGET_NAMESPACE] = reader[_TARGET_NAMESPACE];
     else
         fieldMap.Add(_TARGET_NAMESPACE, reader[_TARGET_NAMESPACE]);
     initialize();
 }
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:29,代码来源:TestSignalLibraryBean.cs

示例7: SignalMasterBean

 public SignalMasterBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_SIGNAL_ID) )
         fieldMap[_SIGNAL_ID] = reader[_SIGNAL_ID];
     else
         fieldMap.Add(_SIGNAL_ID, reader[_SIGNAL_ID]);
     if( fieldMap.ContainsKey(_SIGNAL_NAME) )
         fieldMap[_SIGNAL_NAME] = reader[_SIGNAL_NAME];
     else
         fieldMap.Add(_SIGNAL_NAME, reader[_SIGNAL_NAME]);
     if( fieldMap.ContainsKey(_PARENT_SIGNAL_ID) )
         fieldMap[_PARENT_SIGNAL_ID] = reader[_PARENT_SIGNAL_ID];
     else
         fieldMap.Add(_PARENT_SIGNAL_ID, reader[_PARENT_SIGNAL_ID]);
     if( fieldMap.ContainsKey(_XMLNS) )
         fieldMap[_XMLNS] = reader[_XMLNS];
     else
         fieldMap.Add(_XMLNS, reader[_XMLNS]);
     if( fieldMap.ContainsKey(_UUID) )
         fieldMap[_UUID] = reader[_UUID];
     else
         fieldMap.Add(_UUID, reader[_UUID]);
     initialize();
 }
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:25,代码来源:SignalMasterBean.cs

示例8: openconnection

 /// <summary>
 /// Opens the connection to the database.
 /// </summary>
 static void openconnection()
 {
     dr = null;
     String ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Public\\TRManager\\IncidentDB.accdb;Persist Security Info=False;";
     connection = new OleDbConnection(ConnectionString);
     connection.Open();
 }
开发者ID:UristMcMiner,项目名称:SE-Projekt_RWB.csharp,代码行数:10,代码来源:UtilityDB.cs

示例9: populaLista

        public void populaLista()
        {
            rsPlay = objBD.ExecutaSQL("select PLI_ID, PLI_TITULO, PLI_URL from PlayList where PLI_ATIVO = 1 order by PLI_DH_CADASTRO desc");
            if (rsPlay == null)
            {
                throw new Exception();
            }
            if (rsPlay.HasRows)
            {
                while (rsPlay.Read())
                {
                    if (aux == 1)
                    {
                        objVideo.InnerHtml += "<iframe width=\"480\" height=\"269\" src=\""+rsPlay["PLI_URL"].ToString()+"\" frameborder=\"0\" allowfullscreen></iframe>";
                    }

                    System.Web.UI.WebControls.ListItem R = new System.Web.UI.WebControls.ListItem();
                    R.Value = rsPlay["PLI_ID"].ToString();
                    R.Text = rsPlay["PLI_TITULO"].ToString();
                    slPlayList.Items.Add(R);
                    aux++;
                }
            }
            rsPlay.Close();
            rsPlay.Dispose();
        }
开发者ID:kaizonaro,项目名称:palavracantada,代码行数:26,代码来源:videos.aspx.cs

示例10: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            objUtils = new utils();
            objBD = new bd();

            switch (Request["acao"])
            {
                case ("editar"):
                    rsLista = objBD.ExecutaSQL("select EQU_ID, EQU_NOME, EQU_DESCRICAO from  Equipe where EQU_ID ='" + Request["EQU_ID"] + "'");
                    if (rsLista == null)
                    {
                        throw new Exception();
                    }
                    if (rsLista.HasRows)
                    {
                        rsLista.Read();
                        Response.Write(rsLista["EQU_ID"] + "|" + rsLista["EQU_NOME"] + "|" + rsLista["EQU_DESCRICAO"]);
                    }
                    break;

                default:
                    PopulaLista();

                    break;
            }
        }
开发者ID:kaizonaro,项目名称:palavracantada,代码行数:26,代码来源:palavra-cantada.aspx.cs

示例11: Ultimas

        public void Ultimas()
        {
            rsLista = objBD.ExecutaSQL("select top 3  F.FTO_ID, U.USU_NOME, U.USU_USUARIO, FME_MENSAGEM, CONVERT(VARCHAR(10),FME_DH_PUBLICACAO, 103) AS FME_DH_PUBLICACAO, T.FTO_TITULO from ForumMensagem F inner join ForumTopicos T on (T.FTO_ID = F.FTO_ID) inner join Usuario U ON (U.USU_ID = F.USU_ID) where RED_ID = " + Session["redeID"] + " and F.FME_ATIVO = 1 order by F.FME_DH_PUBLICACAO desc");

            if (rsLista == null)
            {
                throw new Exception();
            }
            if (rsLista.HasRows)
            {
                while (rsLista.Read())
                {
                    ultimasMensagens.InnerHtml += " <div class=\"txt blog_txt txt_forum\">";
                    ultimasMensagens.InnerHtml += "   <div class=\"txt\">";
                    ultimasMensagens.InnerHtml += "       <a href=\"/forum-lista/" + objUtils.GerarURLAmigavel(rsLista["FTO_TITULO"].ToString()) + "/1\" title=\"" + rsLista["FTO_TITULO"] + "\"><p>" + objUtils.CortarString(true, 100, rsLista["FME_MENSAGEM"].ToString()) + "</p></a>";
                    ultimasMensagens.InnerHtml += "       <p class=\"destque_forum\">Mensagem enviada por: <a href='/perfil/" + rsLista["USU_USUARIO"].ToString() + "' title='" + rsLista["USU_NOME"].ToString() + "'>" + rsLista["USU_NOME"].ToString() + "</a></p>";
                    ultimasMensagens.InnerHtml += "       <p class=\"destque_forum\">Enviada em: <b>" + rsLista["FME_DH_PUBLICACAO"].ToString() + "</b></p>";
                    ultimasMensagens.InnerHtml += "       <p class=\"destque_forum\">Tópico: <b><a href=\"/forum-lista/" + objUtils.GerarURLAmigavel(rsLista["FTO_TITULO"].ToString()) + "/1\" title=\"" + rsLista["FTO_TITULO"] + "\">" + rsLista["FTO_TITULO"].ToString() + "</a></b></p><br /><br />";
                    ultimasMensagens.InnerHtml += "   </div>";
                    ultimasMensagens.InnerHtml += " </div>";
                }
            }
            rsLista.Close();
            rsLista.Dispose();
        }
开发者ID:kaizonaro,项目名称:palavracantada,代码行数:25,代码来源:forum.aspx.cs

示例12: actualizador

 private void actualizador()
 {
     Conector();
     comando.CommandText = "select * from t_articulos";
     Lector = comando.ExecuteReader();
     int registros = 0;
              while (Lector.Read() == true)
     {
         DatosCosa[registros]=new Articulo();
         //Cosa = new Articulo();
         DatosCosa[registros].CodigoArti = Convert.ToInt32(Lector["id_articulo"]);
         DatosCosa[registros].NombreArti = Lector["n_articulo"].ToString();
         DatosCosa[registros].Precio = Convert.ToDouble(Lector["precio"]);
        // DatosCosa[registros] = Cosa;
         registros++;
     }
     Lector.Close();
     comando.CommandText = "select * from t_clientes";
     Lector = comando.ExecuteReader();
     registros = 0;
        // DatosFulano = new Clientes[50];
     while (Lector.Read() == true)
     {//Fulano=new Clientes();
         DatosFulano[registros]=new Clientes();
         DatosFulano[registros].Barrio=Convert.ToInt32(Lector["id_barrio"]);
         DatosFulano[registros].Calle=Lector["calle"].ToString();
         DatosFulano[registros].CodigoClle=Convert.ToInt32(Lector["id_cliente"]);
         DatosFulano[registros].NombreClie=Lector["n_cliente"].ToString();
         DatosFulano[registros].NumeroCa=Convert.ToInt32(Lector["calle_nro"]);
         //DatosFulano[registros]=Fulano;
         registros++;
     }
     Lector.Close();
     conexion.Close();
 }
开发者ID:aaferrari,项目名称:Ejercicios,代码行数:35,代码来源:FrmTransacion.cs

示例13: Button1_Click1

        protected void Button1_Click1(object sender, EventArgs e)
        {
            string strGroupName, strGroupContent;

            DateTime dtmCreateDate;

            if (txtGroupName.Text == "")
            {
                this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('请填写群组名称!')</script>");
                return;
            }

            strGroupName = txtGroupName.Text;
            strGroupContent = txtGroupName.Text;

            string strsql;
            myGroup = AccessDateHelper.ExecuteReader("select * from [Group] where UserID=" + Convert.ToInt16(myUserID) + "");
            if (myGroup.Read())
            {
                strsql = "update [Group] set GroupName='" + strGroupName + "',GroupContent='" + strGroupContent + "' where GroupID=" + Convert.ToInt16(myGroup["GroupID"]) + "";
            }
            else
            {
                strsql = "insert into [Group] (GroupName,GroupContent,UserID) values ('" + strGroupName + "','" + strGroupContent + "',"+Convert.ToInt16(myUserID)+")";
            }

            if (AccessDateHelper.ExecuteNonQuery(strsql) > 0)
            {
                this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('群组更改成功!');try{ window.opener.RefreshForm() }catch(e){};</script>");
            }
            else
            {
                this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('新建试题失败!')</script>");
            }
        }
开发者ID:huaminglee,项目名称:NET-KaoShi,代码行数:35,代码来源:MyGroup.aspx.cs

示例14: Button1_Click

    protected void Button1_Click(object sender, EventArgs e)
    {
        conn = new OleDbConnection("Provider=MSDAORA;Data Source=orcl;Persist Security Info=True;Password=db_mail;User ID=db_mail");
        string u_name, password;
        u_name = TextBox1.Text;
        password = TextBox2.Text;
        rec_mail rr = new rec_mail();
        string comp=rr.un_enc(u_name, password);
        //u_name = raw_u_name + password[2];
        //Response.Write(u_name);
        conn.Open();
        cmd=new OleDbCommand ("select enc_fun(user_id,password) from username where user_id='"+ u_name +"'",conn);
        dr = cmd.ExecuteReader();
        //dr.Read();
        //Response.Write(raw_u_name + dr["password"].ToString()[2]);
        if (dr.HasRows == false)
            Label2.Visible = true;
        else
        {
            dr.Read();

            if (dr[0].ToString() == comp)
            {
                Session["us_name"] = u_name;
                Response.Redirect("Mail_box.aspx");
            }
            else
                Label2.Visible = true;
        }
        dr.Close();
        conn.Close();
    }
开发者ID:vedsarkushwaha,项目名称:MyDaak,代码行数:32,代码来源:Default.aspx.cs

示例15: MeasurementUncertainityCalculator

 //Constructor - Initializes the object with data and connects to the database.
 public MeasurementUncertainityCalculator()
 {
     string path;
     path = Path.GetDirectoryName(Application.ExecutablePath);
     try
     {
         connection = new OleDbConnection();
         connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\DB\\UC.mdb;Persist Security Info=False";
         connection.Open();
         command = new OleDbCommand();
         command.Connection = connection;
         command.CommandText = "SELECT count(Sample_Number) FROM InputTable";
         reader = command.ExecuteReader();
         while (reader.Read())
         {
             no_of_obs = (Double.Parse(reader[0].ToString()));
         }
         reader.Close();
         reader = null;
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
开发者ID:GreatDharmatma,项目名称:Projects,代码行数:26,代码来源:MeasurementUncertainityCalculator.cs


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