本文整理汇总了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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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' /> 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);
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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");
}
}
}
示例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 { }
}
示例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");
}
示例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> Código </TD><TD style='text-align: left'> Nome </TD>"
+ "<TD> Preço </TD><TD> Quantidade </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;'> "
+ 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;
}
}
示例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"),
};
}
示例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;
}
示例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;
}