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


C# OleDbDataReader.GetString方法代码示例

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


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

示例1: AddNodeItem

        protected override TreeNode AddNodeItem(TreeNode aTn, OleDbDataReader aReader, ref int aSI)
        {
            /// В pSQLString должен быть определен примерно такой select:
              /// ...
              /// SELECT
              ///		refCode, refBName, 1, ...
              /// FROM
              ///		rbRef
              /// ...

              TreeNode ntn = new TreeNode(aReader.GetString(1));
              PCTVItemData tid = new PCTVItemData();
              ntn.Tag = tid;
              tid.pPC.code = aReader.GetInt32(0);
              /// Added M.Tor 25.06.2008:
              tid.pText = aReader.GetString(1);
              if (aReader.GetInt32(2) > 0)
            ntn.Nodes.Add(new TreeNode());

              if (aTn == null)
              {
            Nodes.Add(ntn);
            tid.pPath = tid.pCode.ToString();
              }
              else
              {
            aTn.Nodes.Add(ntn);
            tid.pPath = ((PCTVItemData)aTn.Tag).pPath + pPathDelim + tid.pCode;
              }

              aSI = 3;

              return ntn;
        }
开发者ID:infobook,项目名称:Query3,代码行数:34,代码来源:ucParamTV.cs

示例2: Initialise

        public void Initialise()
        {
            string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=phonebook.accdb";
            OleDbConnection conn = new OleDbConnection(connectionString);

            string sql = "SELECT * FROM task ORDER BY id";

            OleDbCommand cmd = new OleDbCommand(sql, conn);

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();
                reader.Read();

                lblTask.Text = reader.GetString(1).ToString();
                txtTask.Text = reader.GetString(2).ToString();

                reader.Close();
                conn.Close();
            }
            catch
            {
                //MessageBox.Show(e.Message);
            }
        }
开发者ID:ptchankue,项目名称:mimi,代码行数:27,代码来源:frmEvaluation.cs

示例3: Login

        // Constructor for searched login
        public Login(uint gloid)
        {
            // Declarations
            uint gvoid = 0, modifiedby = 0;
            string username = null, password = null, note = null, status = null;
            bool active = false;
            DateTime datemodified = new DateTime(1901, 1, 1);

            // Command
            string query = string.Format("SELECT glo_username, glo_password, glo_note, glo_active, glo_status, gvo_id, date_modified, modified_by FROM gfrc_login" +
                                            " WHERE glo_id = {0}", gloid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        username = rdr.GetString(0);
                        password = rdr.GetString(1);
                        note = rdr.GetString(2);
                        active = rdr.GetBoolean(3);
                        status = rdr.GetString(4);
                        if (!UInt32.TryParse(rdr.GetValue(5).ToString(), out gvoid))
                            gvoid = 0;
                        if (!DateTime.TryParse(rdr.GetValue(6).ToString(), out datemodified))
                            datemodified = new DateTime(1901, 1, 1);
                        if (!UInt32.TryParse(rdr.GetValue(7).ToString(), out modifiedby))
                            modifiedby = 0;
                    }
                }
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            _gloID = gloid;
            _Username = username;
            _Password = password;
            _Note = note;
            _Active = active;
            _Status = status;
            _gvoID = gvoid;
            _DateModified = datemodified;
            _ModifiedBy = modifiedby;
        }
开发者ID:CyanideGiraffe,项目名称:GFRC,代码行数:57,代码来源:Login.cs

示例4: Advertisement

 public Advertisement(OleDbDataReader reader)
 {
     this.StrId = reader.GetString(0);
     if (!reader.IsDBNull(1))
         this.IntType = reader.GetInt32(1);
     else
         this.IntType = 3;
     if (!reader.IsDBNull(2))
         this.StrContent = reader.GetString(2);
     else
         this.StrContent = "";
 }
开发者ID:vanloc0301,项目名称:ecouponsprinter,代码行数:12,代码来源:DownloadInfo.cs

示例5: Form_Update

        public Form_Update(OleDbDataReader oddr)
        {
            InitializeComponent();

            connector = new DBconnector();

            while (oddr.Read())
            {
                tb_Name.Text = oddr.GetString(0);
                tb_Desc.Text = oddr.GetString(2);
                tb_Seq.Text = oddr.GetString(3);
            }
        }
开发者ID:igemsoftware,项目名称:CBNU_KOREA_2012,代码行数:13,代码来源:Form_Update.cs

示例6: Form1

        public Form1()
        {
            InitializeComponent();
            PC.list = new List<PC>();
            PC.total = new List<PC>();
            data.Columns.Add("Id", "Id");
            data.Columns.Add("PC", "PC");
            data.Columns.Add("Inicio", "Inicio");
            data.Columns.Add("Tiempo", "Tiempo");
            data.Columns.Add("Total", "Total");
            data.Columns[3].Width = 130;
            data.Columns[3].Width = 130;
            r = MSAConnection.read("select * from item");
            while (r.Read())
            {
                String d = "";
                PC p = new PC();
                p.id = r.GetInt32(0);
                p.precio = r.GetInt32(2);
                if (!r.IsDBNull(3))
                {
                    //d = r.GetDateTime(3).ToString();
                    DateTime x = r.GetDateTime(3);
                    d = x.Hour + ":" + x.Minute + ":" + x.Second;
                    p.inicio = r.GetDateTime(3);
                    PC.list.Add(p);
                }
                PC.total.Add(p);
                data.Rows.Add(r.GetInt32(0), r.GetString(1), d);
            }
            //            MessageBox.Show(PC.total.Count + "");

            thetimer.Start();
        }
开发者ID:evilnapsis,项目名称:cibertim-msa,代码行数:34,代码来源:Form1.cs

示例7: Coupon

 public Coupon(OleDbDataReader reader)
 {
     this.StrId = reader.GetString(0);
     if (!reader.IsDBNull(1))
         this.StrSmallImg = reader.GetString(1);
     else
         this.strSmallImg = "";
     if (!reader.IsDBNull(2))
         this.StrLargeImg = reader.GetString(2);
     else
         this.StrLargeImg = "";
     if (!reader.IsDBNull(3))
         this.StrPrintImg = reader.GetString(3);
     else
         this.StrPrintImg = "";
 }
开发者ID:vanloc0301,项目名称:ecouponsprinter,代码行数:16,代码来源:DownloadInfo.cs

示例8: consultaUmLivro

        public static void consultaUmLivro()
        {
            String aux = "select * from TabLivro where codigo ='" + Livro.getCodigo() + "'";

            conecta();
            strSQL = new OleDbCommand(aux, conn);
            result = strSQL.ExecuteReader();
            Erro.setErro(false);
            if (result.Read())
            {
                Livro.setTitulo(result.GetString(1));
                Livro.setAutor(result.GetString(2));
                Livro.setEditora(result.GetString(3));
                Livro.setAno(result.GetString(4));
            }
            else
                Erro.setMsg("Livro não cadastrado.");
            desconecta();
        }
开发者ID:jcbombardelli,项目名称:SistemasDeInformacao,代码行数:19,代码来源:LivroDAL.cs

示例9: ValidarUtilizador

        //
        //  Validar o Utilizador que se ligou ao servidor
        //      nome: O Nome de Utilizador
        //      pass: Password
        //  
        //  Retorna: true se o utilizador foi encontrado na Base de Dados e se a password estava correcta
        //           false se o utilizador não existe ou a password estava incorrecta
        //
        public bool ValidarUtilizador(String nome, String pass)
        {
            try
            {
                OleDbCommand cmdSQL = LigacaoBD.CreateCommand();
                cmdSQL.CommandText = "SELECT * FROM tabela_utilizadores_src";
                LeitorBD = cmdSQL.ExecuteReader();

                while (LeitorBD.Read())
                {
                    if (LeitorBD.GetString(0) == nome && LeitorBD.GetString(1) == pass)
                    {
                        return true;
                    }
                }
            }
            catch (OleDbException) { }
                
            return false;
            
        }
开发者ID:rvelhote,项目名称:university,代码行数:29,代码来源:BaseDeDados.cs

示例10: Kontaktdaten

        public Kontaktdaten()
        {
            InitializeComponent();
            try
            {
                dBVerbindung = new OleDbConnection(verbindungsstring);
                dBVerbindung.Open();
                offen = true;
                befehl = dBVerbindung.CreateCommand();
                //Übersicht (DataGHridView) anzeigen
                befehl.CommandText = "select * from Kontakte;";
                datenleser = befehl.ExecuteReader();
                int row = 0;
                while (datenleser.Read())
                {
                    //leere zeile hinzufügen
                    string[] row_init = { "", "", "", "", "" };
                    dataGridViewKontakte.Rows.Add(row_init);
                    //GridView füllen
                    dataGridViewKontakte.Rows[row].Cells[0].Value = datenleser.GetInt32(0).ToString();
                    dataGridViewKontakte.Rows[row].Cells[1].Value = datenleser.GetString(1);
                    dataGridViewKontakte.Rows[row].Cells[2].Value = datenleser.GetString(2);
                    dataGridViewKontakte.Rows[row].Cells[3].Value = datenleser.GetString(3);
                    dataGridViewKontakte.Rows[row].Cells[4].Value = datenleser.GetString(4);
                    dataGridViewKontakte.Rows[row].Cells[5].Value = datenleser.GetString(5);
                    row = row + 1;
                }

            }
            catch (Exception ausnahme)
            {
                MessageBox.Show("Datenbankfehler: " + ausnahme.Message);
            }
            finally
            {
                if (offen == true) dBVerbindung.Close();
            }
        }
开发者ID:Totti1987,项目名称:Terminverwaltung,代码行数:38,代码来源:Kontaktdaten.cs

示例11: Load

 public static void Load(this DataObject dataObj, OleDbDataReader reader)
 {
     try
     {
         foreach (ColumnDefinition columnDef in dataObj.ColumnDefs())
         {
             if (reader.GetValue(columnDef.ColumnIndex) != DBNull.Value)
             {
                 switch (columnDef.ColumnFieldType)
                 {
                     case ColumnDefinition.FieldType.String:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetString(columnDef.ColumnIndex);
                         break;
                     case ColumnDefinition.FieldType.Int32:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetInt32(columnDef.ColumnIndex);
                         break;
                     case ColumnDefinition.FieldType.Boolean:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetBoolean(columnDef.ColumnIndex);
                         break;
                 }
             }
             else //default values for nulls
             {
                 switch (columnDef.ColumnFieldType)
                 {
                     case ColumnDefinition.FieldType.String:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = string.Empty;
                         break;
                     case ColumnDefinition.FieldType.Int32:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = 0;
                         break;
                     case ColumnDefinition.FieldType.Boolean:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = false;
                         break;
                 }
             }
         }
     }
     catch (Exception e)
     {
         //TODO: what to do here?
     }
 }
开发者ID:carriercomm,项目名称:InventoryManagement,代码行数:43,代码来源:DataAccessExtensions.cs

示例12: vQualification

        // Constructor for searched volunteer qualification
        public vQualification(uint gvqid)
        {
            // Declarations
            uint gvoid = 0;
            string qualification = null;

            // Command
            string query = string.Format("SELECT gvo_id, gvq_qual " +
                                            "FROM gfrc_volunteer_qualification WHERE gvq_id = {0}", gvqid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        UInt32.TryParse(rdr.GetValue(0).ToString(), out gvoid);
                        qualification = rdr.GetString(1);
                    }
                }
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            _gvqID = gvqid;
            _gvoID = gvoid;
            _Qualification = qualification;
        }
开发者ID:CyanideGiraffe,项目名称:GFRC,代码行数:40,代码来源:vQualification.cs

示例13: ExecutaComando

		public String ExecutaComando(string comandoSql) 
		{
            StringBuilder lido = new StringBuilder();

			cmd.CommandText = comandoSql;
            try
            {
                using (leitor = cmd.ExecuteReader())
                {

                    while (leitor.Read())
                    {
                        lido.Append(leitor.GetString(0));
                    }
                }
            }
            finally
            {
                if (leitor != null)
                    leitor.Close();
            }

			return lido.ToString();
		}
开发者ID:andrepontesmelo,项目名称:imjoias,代码行数:24,代码来源:Dbf.cs

示例14: getFoodList

        internal static List<FoodList> getFoodList()
        {
            List<FoodList> fl = new List<FoodList>();
            try
            {
                cmd = new OleDbCommand("SELECT ID, FoodName, FoodPrice, FoodType FROM FoodList ORDER BY FoodName;", conn);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    FoodList fudList = new FoodList(reader.GetInt32(0).ToString(), reader.GetString(1), reader.GetInt32(2), reader.GetString(3));
                    fl.Add(fudList);
                }

            }
            catch (Exception ee)
            {
                reader.Close();
                MessageBox.Show("getFoodList() error: " + ee.ToString());
            }
            reader.Close();
            return fl;
        }
开发者ID:felixnoriel,项目名称:thesisrepository,代码行数:22,代码来源:DataServices.cs

示例15: listQualifications

        public Vector<vQualification> listQualifications(uint gvoid)
        {
            // Declarations
            Vector<vQualification> quals = new Vector<vQualification>();
            uint gvqid = 0;
            string qualification = null;
            vQualification input = new vQualification();

            // Command
            string query = string.Format("SELECT gvq_id, gvq_qual " +
                                            "FROM gfrc_volunteer_qualification WHERE gvo_id = {0}", gvoid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        if (!UInt32.TryParse(rdr.GetValue(0).ToString(), out gvqid))
                            gvqid = 0;
                        qualification = rdr.GetString(1);
                        if (gvqid != 0)
                        {
                            input = new vQualification(gvqid, gvoid, qualification);
                            quals.Add(input);
                        }

                    }
                }
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            return quals;
        }
开发者ID:CyanideGiraffe,项目名称:GFRC,代码行数:46,代码来源:vQualification.cs


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