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


C# MySqlDataReader.GetString方法代码示例

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


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

示例1: readerToJedinicaMjereDTO

 public static JedinicaMjereDTO readerToJedinicaMjereDTO(MySqlDataReader reader)
 {
     JedinicaMjereDTO jedinicaMjere = new JedinicaMjereDTO();
     jedinicaMjere.SifraJediniceMjere = reader.GetString("SifraJediniceMjere");
     jedinicaMjere.OpisJediniceMjere = reader.GetString("OpisJediniceMjere");
     return jedinicaMjere;
 }
开发者ID:RockLegend93,项目名称:Veleprodaja,代码行数:7,代码来源:MySqlJedinicaMjereDAO.cs

示例2: ReceiveManager

        public ReceiveManager(MySqlDataReader dataReader,MetroForm _login)
        {
            InitializeComponent();
            login = _login;
            this.FormClosing += ReceiveManager_FormClosing;
            worker_id = dataReader.GetString("worker_name");
            this.Text = "欢迎回来," + dataReader.GetString("worker_name");
            dataReader.Close();
            DataGridViewButtonColumn request_column = new DataGridViewButtonColumn();
            request_column.HeaderText = "请求";
            //gigUrlColumn.Name = "Gig Url name";
            request_column.Text = "确认";
            request_column.UseColumnTextForButtonValue = true;
            request_column.Width = 106;
            WaitToConfrimDataGridView.Columns.Add(request_column);
            WaitToConfrimDataGridView.DataSource = FillDataGrid();

            DataGridViewButtonColumn request2_column = new DataGridViewButtonColumn();
            request2_column.HeaderText = "请求";
            //gigUrlColumn.Name = "Gig Url name";
            request2_column.Text = "接货成功";
            request2_column.UseColumnTextForButtonValue = true;
            request2_column.Width = 106;
            CheckGridView.Columns.Add(request2_column);
            CheckGridView.DataSource = FillCheckData();
        }
开发者ID:SivilTaram,项目名称:BUAA_DataBase,代码行数:26,代码来源:ReceiveManager.cs

示例3: ReviewRecipeData

        private void ReviewRecipeData(String recId)
        {
            ///Get recipe data from database by recipe id
            try
            {
                CheckStateDB();
                String sql_get = "SELECT recipe_name, detail, materialCode FROM recipe WHERE recipe_id = @recipe_id";
                cmd = new MySqlCommand(sql_get, conn);
                cmd.Parameters.AddWithValue("@recipe_id", recId);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    this.recipeName.Text = reader.GetString("recipe_name");
                    this.recipeDetail.Text = reader.GetString("detail");
                    this.recipeMaterial.Text = reader.GetString("materialCode");
                }
                reader.Close();

            }
            catch (Exception e)
            {
                ErrorLogCreate(e);
                MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง"
                                    , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
开发者ID:primetogo,项目名称:FactoryManagement,代码行数:26,代码来源:RecipeEdit.xaml.cs

示例4: CheckLogin

        public LoginCode CheckLogin(string username, string password)
        {
            string tusername = "", tpassword = "";
            string sql = "SELECT * from user where user='"+username+"'";



            MySqlCommand cmd = new MySqlCommand(sql, this.myCon);

            myCon.Open();
            myRead = cmd.ExecuteReader();
            myCon.Close();
            while (myRead.Read())
            {
                tusername = myRead.GetString("username");
                tpassword = myRead.GetString("password");
            }

            if (tusername != null)
            {
                if (tpassword == password)
                {
                    return LoginCode.LOGIN_SUCCESS;
                }
            }
            else
            {
                
            }

            return LoginCode.PASSWORD_INCORRECT;

        }
开发者ID:arikaya,项目名称:TReactor,代码行数:33,代码来源:XMySQL.cs

示例5: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        nid = Request.QueryString["news_id"];
        try
        {
            con.Open();
            cmd = new MySqlCommand("select * from news where newsid='" + nid + "'", con);
            dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                article.Text = "<h1 style='font-size:25px'>" + dr.GetString("headline").Substring(0, 1).ToUpper() + dr.GetString("headline").Substring(1).ToLower() + "</h1><br/><br/><img alt='' src='../images/tag.png' />&nbsp;Alumni News<br/><br/>";
                article.Text += " <p style='text-align: justify;'>" + dr.GetString("story") + "</p>";
                article.Text += "<p style='text-align: justify;'><a href='http://alumni.ssn.edu.in/alumni-stories.php'>http://alumni.ssn.edu.in/alumni-stories.php</a></p>";
                dr.Close();
                con.Close();
            }
            else
            {
                rerr.Visible = true;
            }

        }
        catch (Exception ex)
        {
            CreateLogFile log = new CreateLogFile();
            log.ErrorLog(Server.MapPath("../Logs/Errorlog"), "Page load method of NewsRead page for " + Session["loginname"] + ":" + ex.Message);
        }
    }
开发者ID:vivek9088,项目名称:Alumni-Website,代码行数:28,代码来源:NewsRead.aspx.cs

示例6: LoadSector

 public List<Sector> LoadSector()
 {
     try
     {
         using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters()))
         {
             listSec = new List<Sector>();
             cn.Open();
             sql = "select * from asada.view_sectores";
             cmd = new MySqlCommand(sql, cn);
             reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 sec = new Sector();
                 sec.Code = reader.GetString(0);
                 sec.Consecutive = reader.GetInt32(1);
                 sec.Description = reader.GetString(2);
                 listSec.Add(sec);
             }
             reader.Close();
             return listSec;
         }
     }
     catch (Exception e)
     {
         Logs lg = new Logs();
         lg.Log(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + ", " + e.Message.ToString());
         throw;
     }
 }
开发者ID:GCA7,项目名称:Asada07,代码行数:30,代码来源:SectorDAO.cs

示例7: LoadSector

 public List<Sector> LoadSector()
 {
     try
     {
         using (MySqlConnection cn = new MySqlConnection((clsCon=new Connection(this.user)).Parameters()))
         {
             listSec = new List<Sector>();
             cn.Open();
             sql = "select * from asada.view_sectores";
             cmd = new MySqlCommand(sql, cn);
             reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 sec = new Sector();
                 sec.Code = reader.GetString(0);
                 sec.Consecutive = reader.GetInt32(1);
                 sec.Description = reader.GetString(2);
                 listSec.Add(sec);
             }
             reader.Close();
             return listSec;                    
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
开发者ID:MBLopez,项目名称:Asada07,代码行数:28,代码来源:SectorDAO.cs

示例8: LoadTarifa

        public List<Tarifa> LoadTarifa()
        {
            try
            {
                using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters()))
                {
                    lisTrf = new List<Tarifa>();
                    cn.Open();
                    sql = "select * from asada.view_tarifas";
                    cmd = new MySqlCommand(sql, cn);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        trf = new Tarifa();
                        trf.Code = reader.GetString(0);
                        trf.FixAmount = float.Parse(reader.GetString(1));
                        trf.MetAmount = float.Parse(reader.GetString(2));
                        trf.RateHidrant = float.Parse(reader.GetString(3));
                        trf.TypeAppString = reader.GetString(4);
                        lisTrf.Add(trf);
                    }
                    reader.Close();
                    return lisTrf;
                }
            }
            catch (Exception)
            {
                throw;
            }

        }        
开发者ID:MBLopez,项目名称:Asada07,代码行数:31,代码来源:TarifaDAO.cs

示例9: btnlogin_Click

        private void btnlogin_Click(object sender, EventArgs e)
        {
            connection = db.getConnection();
            if (connection != null)
            {
                command = new MySqlCommand("select * from user_reg where userid='" + textBox1.Text + "'and password='" + textBox2.Text + "'", connection);
                dr = command.ExecuteReader();
                if (dr.HasRows)
                {
                    dr.Read();
                    role = dr.GetString(3);
                    if (textBox1.Text == dr.GetString(0) && textBox2.Text == dr.GetString(2))
                    {
                        user = textBox1.Text;
                        home h = new home();
                        h.Show();
                        this.Hide();

                    }
                    else
                    {
                        textBox1.Text = "";
                        textBox2.Text = "";
                        MessageBox.Show("Invalid user name or password");
                    }
                }
                else
                {
                    textBox1.Text = "";
                    textBox2.Text = "";
                    MessageBox.Show("Invalid user name or password");
                }
            }
        }
开发者ID:Vedya,项目名称:SPY-Bullion,代码行数:34,代码来源:LogIn.cs

示例10: Entregador

        public Entregador(MySqlDataReader rs)
        {
            try
            {
                int i = 0;
                while (true)
                {
                    switch (rs.GetName(i))
                    {
                        case "cpf":
                            this.cpf = rs.GetString(i);
                            break;
                        case "nome":
                            this.nome = rs.GetString(i);
                            break;
                        case "telefone":
                            if (this.telefone == null) this.telefone = new model.Telefone();
                            this.telefone.Numero = rs.GetString(i);
                            break;
                        case "placa":
                            this.placa = rs.GetString(i);
                            break;
                        default:
                            throw new Exception("Propriedade não encontrada");
                    }

                    i++;
                }
            }
            catch { }
        }
开发者ID:fmontezuma,项目名称:fmontezuma,代码行数:31,代码来源:Entregador.cs

示例11: Pages

 public Pages(MySqlDataReader reader)
 {
     this.Id = reader.GetInt32("id");
     this.Title = reader.GetString("title");
     this.LinkTitle = reader.GetString("linktitle");
     this.PageType = reader.GetString("pagetype");
     this.Content = reader.GetString("content");
 }
开发者ID:kbrooker99206,项目名称:jewelleesherbals,代码行数:8,代码来源:clsPages.cs

示例12: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Id"] == null) Response.Redirect("Logon.aspx");
        string Iduser =  Convert.ToString(Session["Id"]);
        Label1.Visible = false;
        try
        {
            conexao = new MySqlConnection("server=localhost; port=3306; user id=root; password=root; database= lojaonline");
            conexao.Open();

            string sql = "SELECT produtos.*, comprasefetuadas.* from produtos INNER JOIN comprasefetuadas ON produtos.idprod=comprasefetuadas.idproduto WHERE [email protected] ORDER BY produtos.nomeprod";

            stm = new MySqlCommand(sql, conexao);
            stm.Parameters.AddWithValue("@id", Iduser);
            stm.Prepare();

            dr = stm.ExecuteReader();

            String strHTML = "";
            if (dr.HasRows)
            { //mostramos o cabeçalho da <table> somente se temos registros
                strHTML = "<TABLE name=produts border=1 width='65%'> <TR style='font-size: 14px; font-family: verdana; text-align: center; font-weight: 900; color: #009;'>"
                    + "<TD>&nbsp;Código&nbsp;</TD><TD style='text-align: left'>&nbsp;Nome&nbsp;</TD>"
                    + "<TD>&nbsp;Preço&nbsp;</TD><TD>&nbsp;Quantidade&nbsp;</TD></TR>";
            }
            else
            {
                Label1.Visible = true;
                Label1.Text = "Este usuário não comprou produtos ainda nesta loja on-line";
            }

            while (dr.Read())
            {
                String codigo = dr.GetString("idprod");
                String nome = dr.GetString("nomeprod");
                String preco = dr.GetString("preco");
                String qtde = dr.GetString("qtdecomprada");
                strHTML += "<TR><TD style='font-size: 12px; font-family: verdana; text-align: center;'>" + codigo
                        + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: left;'>&nbsp;&nbsp;"
                        + nome + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>"
                        + preco + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>"
                        + qtde + "</TD></TR>";
            }

            strHTML += "</TABLE> <br/><br/><br/>";
            LiteralControl lc = new LiteralControl(strHTML);
            Panel1.Controls.Add(lc);
            stm.Dispose();
            dr.Close();
            conexao.Close();
        }
        catch (Exception exc)
        {
            Label1.Visible = true;
            Label1.Text = "Erro no processamento do BD - " + exc.Message;
        }

    }
开发者ID:rodrigogregorioneri,项目名称:Projetos-e-exercicios-faculdade,代码行数:58,代码来源:Comprados.aspx.cs

示例13: ReadMessage

		Message ReadMessage (MySqlDataReader r)
		{
			return new Message {
				Id = new Guid (r.GetString ("Id")),
				From = r.GetString ("From"),
				Text = r.GetString ("Text"),
				Time = r.GetDateTime ("Time"),
			};
		}
开发者ID:GSerjo,项目名称:Seminars,代码行数:9,代码来源:MySqlRepository.cs

示例14: Map

 public SearchPost Map(MySqlDataReader rdr)
 {
     SearchPost SP = new SearchPost();
     SP.Url = HttpContext.Current.Request.Url.AbsoluteUri + "/"+ rdr.GetInt32("id");
     SP.Id = rdr.GetInt32("id");
     SP.Body = rdr.GetString("body");
     SP.Title = rdr.GetString("title");
     return SP;
 }
开发者ID:Steven1988,项目名称:portfolio-2,代码行数:9,代码来源:PostMapper.cs

示例15: GetEvenementFromDataReader

        protected Evenement GetEvenementFromDataReader(MySqlDataReader dataReader)
        {
            int evenementId = dataReader.GetInt32("evenement_id");
            Lokatie lokatie = (Lokatie)Enum.Parse(typeof(Lokatie), dataReader.GetString("lokatie"));
            DateTime datum = dataReader.GetDateTime("datum");
            string evenementNaam = dataReader.GetString("evenementnaam");

            Evenement evenement = new Evenement { ID = evenementId, Datum = datum, Lokatie = lokatie, Naam = evenementNaam };
            return evenement;
        }
开发者ID:CVD95,项目名称:WebshopDierenwinkel,代码行数:10,代码来源:DatabaseController.cs


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