本文整理汇总了C#中MySql.Data.MySqlClient.MySqlDataReader.GetDouble方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDataReader.GetDouble方法的具体用法?C# MySqlDataReader.GetDouble怎么用?C# MySqlDataReader.GetDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql.Data.MySqlClient.MySqlDataReader
的用法示例。
在下文中一共展示了MySqlDataReader.GetDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Mapper
public static Champion Mapper(MySqlDataReader r)
{
var c = new Champion();
c.Id = r.GetInt32("Id");
c.Name = r.GetString("Name");
c.Title = r.GetString("Title");
c.Stat = new Stat();
c.Stat.Mana = r.GetDouble("Mana");
c.Stat.ManaPerLv = r.GetDouble("ManaPerLevel");
c.Stat.MagicResist = r.GetDouble("MagicResist");
c.Stat.MagicResistPerLv = r.GetDouble("MagicResistPerLevel");
return c;
}
示例2: DBColumnToPyObject
public static PyObject DBColumnToPyObject(int index, ref MySqlDataReader reader)
{
Type type = reader.GetFieldType(index);
switch (type.Name)
{
case "String":
return new PyString(reader.GetString(index));
case "UInt32":
case "Int32":
case "UInt16":
case "Int16":
case "SByte":
case "Byte":
return new PyInt(reader.GetInt32(index));
case "UInt64":
case "Int64":
return new PyLongLong(reader.GetInt64(index));
case "Byte[]":
return new PyBuffer((byte[])reader.GetValue(index));
case "Double":
return new PyFloat(reader.GetDouble(index));
case "Decimal":
return new PyFloat((double)reader.GetDecimal(index));
case "Boolean":
return new PyBool(reader.GetBoolean(index));
default:
Log.Error("Database", "Unhandled MySQL type " + type.Name);
break;
}
return null;
}
示例3: readerToProjekcijaDTO
public static ProjekcijaDTO readerToProjekcijaDTO(MySqlDataReader reader,FilmDTO film)
{
ProjekcijaDTO projekcija = new ProjekcijaDTO();
projekcija.Id = reader.GetInt32("idProjekcija");
projekcija.Vrijeme = reader.GetDateTime("vrijemeProjekcija");
projekcija.Cijena = reader.GetDouble("cijenaProjekcija");
projekcija.Film =film;
projekcija.Sala = MySqlSalaDAO.readerToSalaDTO(reader);
return projekcija;
}
示例4: execReader
public FinanceiroType execReader(MySqlDataReader dr)
{
FinanceiroType type = new FinanceiroType();
type.IdFinanceiro = Convert.ToInt32(dr["id_financeiro"].ToString());
type.IdAssociacao = Convert.ToInt32(dr["id_associacao"].ToString());
type.Titulo = dr["titulo"].ToString();
type.Valor = dr.GetDouble("valor");
type.Data = dr["data"].ToString();
type.Tipo = dr["tipo"].ToString();
return type;
}
示例5: readerToStavkaOtpremniceDTO
public static StavkaOtpremniceDTO readerToStavkaOtpremniceDTO(MySqlDataReader reader)
{
StavkaOtpremniceDTO stavka = new StavkaOtpremniceDTO();
stavka.Kolicina = reader.GetDouble("Kolicina");
stavka.VeleprodajnaCijena = reader.GetDouble("VeleprodajnaCijena");
stavka.Rabat = reader.GetDouble("Rabat");
stavka.CijenaSaRabatom = reader.GetDouble("CijenaSaRabatom");
stavka.IznosSaRabatom = reader.GetDouble("IznosSaRabatom");
stavka.VeleprodajniIznos = reader.GetDouble("VeleprodajniIznos");
return stavka;
}
示例6: getProductDetailFromDataReader
protected ProductDetail getProductDetailFromDataReader(MySqlDataReader datareader)
{
ProductDetail productDetail = new ProductDetail
{
detailId = datareader.GetInt32("detailID"),
verkoopprijs = datareader.GetDouble("verkoopprijs"),
inkoopprijs = datareader.GetDouble("inkoopprijs"),
maatId = datareader.GetInt32("maatId"),
voorraad = datareader.GetInt32("voorraad"),
};
return productDetail;
}
示例7: readerToStavkaKalkulacijeDTO
private StavkaKalkulacijeDTO readerToStavkaKalkulacijeDTO(MySqlDataReader reader)
{
StavkaKalkulacijeDTO stavka = new StavkaKalkulacijeDTO();
stavka.Kolicina = reader.GetDouble("Kolicina");
stavka.NabavnaCijena = reader.GetDouble("NabavnaCijena");
stavka.Rabat = reader.GetDouble("Rabat");
stavka.NetoNabavnaCijena = reader.GetDouble("NetoNabavnaCijena");
stavka.VeleprodajnaCijena = reader.GetDouble("VeleprodajnaCijena");
stavka.RazlikaUCijeni = reader.GetDouble("RazlikaUCijeni");
stavka.NabavnaVrijednost = reader.GetDouble("NabavnaVrijednost");
stavka.VeleprodajnaVrijednost = reader.GetDouble("VeleprodajnaVrijednost");
return stavka;
}
示例8: Mapper
public static Rune Mapper(MySqlDataReader reader)
{
var r = new Rune();
r.Id = reader.GetInt32("Id");
r.Name = reader.GetString("Name");
r.Ap = reader.GetDouble("Ap");
r.ApPerLevel = reader.GetDouble("ApPerLevel");
r.Mana = reader.GetDouble("Mana");
r.ManaPerLevel = reader.GetDouble("ManaPerLevel");
r.MagicResist = reader.GetDouble("MagicResist");
r.MagicResistPerLevel = reader.GetDouble("MagicResistPerLevel");
r.MagicPenetrationFlat = reader.GetDouble("MagicPenetrationFlat");
return r;
}
示例9: cb_Agregar_SelectedIndexChanged
private void cb_Agregar_SelectedIndexChanged(object sender, EventArgs e)
{
if (rb_Materiales.Checked == true)
{
query = "SELECT Codigo, Descripcion, Unidad, Costo, Rendimiento, Importe FROM listapu.materiales WHERE Codigo = '" + cb_Agregar.Text + "';";
con = new MySqlConnection(constring);
cmd = new MySqlCommand(query, con);
con.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
string Codigo = reader.GetString("Codigo");
string Descripcion = reader.GetString("Descripcion");
string Unidad = reader.GetString("Unidad");
double Costo = reader.GetDouble("Costo");
double Rendimiento = reader.GetDouble("Rendimiento");
double Importe = reader.GetDouble("Importe");
txtCodigo.Text = Codigo;
txtDesc.Text = Descripcion;
txtUnidad.Text = Unidad;
txtCosto.Text = Costo.ToString("0.##");
lbl_Ocupacion.Visible = false;
lbl_Descripcion.Visible = true;
lbl_Sueldo.Visible = false;
lbl_Costo.Visible = true;
lbl_Salario.Visible = false;
lbl_CostoHr.Visible = false;
}
con.Close();
}
else
if (rB_ManodeObra.Checked == true)
{
query = "SELECT Codigo, Ocupacion, SueldoSemanalVigente, SalarioTotal, Rendimiento, Importe FROM listapu.manodeobra WHERE Codigo = '" + cb_Agregar.Text + "';";
con = new MySqlConnection(constring);
cmd = new MySqlCommand(query, con);
con.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
string Codigo = reader.GetString("Codigo");
string ocupacion = reader.GetString("Ocupacion");
double Sueldo = reader.GetDouble("SueldoSemanalVigente");
double Salario = reader.GetDouble("SalarioTotal");
double Rendimiento = reader.GetDouble("Rendimiento");
double Importe = reader.GetDouble("Importe");
txtCodigo.Text = Codigo;
txtDesc.Text = ocupacion;
txtUnidad.Text = Sueldo.ToString("0.##");
txtCosto.Text = Salario.ToString("0.##");
}
con.Close();
lbl_Ocupacion.Visible = true;
lbl_Descripcion.Visible = false;
lbl_Sueldo.Visible = true;
lbl_Costo.Visible = false;
lbl_Salario.Visible = true;
lbl_CostoHr.Visible = false;
}
else
if (rB_EqMaq.Checked == true)
{
query = "SELECT Codigo, Descripcion, Unidad, CostoHr, Rendimiento, Importe FROM listapu.equipo WHERE Codigo = '" + cb_Agregar.Text + "';";
con = new MySqlConnection(constring);
cmd = new MySqlCommand(query, con);
con.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
string Codigo = reader.GetString("Codigo");
string Descripcion = reader.GetString("Descripcion");
string Unidad = reader.GetString("Unidad");
double Costo = reader.GetDouble("CostoHr");
double Rendimiento = reader.GetDouble("Rendimiento");
double Importe = reader.GetDouble("Importe");
txtCodigo.Text = Codigo;
txtDesc.Text = Descripcion;
txtUnidad.Text = Unidad;
txtCosto.Text = Costo.ToString("0.##");
}
con.Close();
lbl_Ocupacion.Visible = false;
lbl_Descripcion.Visible = true;
lbl_Sueldo.Visible = false;
lbl_Costo.Visible = false;
lbl_Salario.Visible = false;
lbl_CostoHr.Visible = true;
}
}
示例10: QueryDB
IEnumerator QueryDB(float seconds)
{
double xDiff, yDiff, xNewPos, yNewPos;
// My Nexus 5
//string query = "SELECT x, y from devicelocations where deviceID = '4192fe2d3b7fbf27';";
//string query = "SELECT i, j, virtual from devicelocations where deviceID = '4192fe2d3b7fbf27';";
//***
//string query = "SELECT i, j from devicelocations where deviceID = '4192fe2d3b7fbf27';";
string query = "SELECT i, j from devicelocations";
//Group's Nexus 4
//string query = "SELECT x, y from devicelocations where deviceID = 'c76129348d8acd2e';";
//string query = "SELECT i, j, virtual from devicelocations where deviceID = 'c76129348d8acd2e';";
while (true) {
try {
if (con.State.CompareTo(ConnectionState.Open) != 0) {
con.Open(); //this line causes the windows-1252 encoding error if I18N DLLs are not included, even though it only OPENS the connection & hasn't actually requested any data yet (easy solution - include the I18N DLLs)
}
using (con) {
using (cmd = new MySqlCommand(query, con)) {
read = cmd.ExecuteReader();
while (read.Read()) {
for (int i = 0; i < read.FieldCount; i++) {
//xDiff = Math.Abs(read.GetDouble(0) - anchorAtlasX);
xDiff = Math.Abs((read.GetDouble(0) - anchorAtlasI));
Double xDiffMeters = xDiff / pixelsPerMeter;
//yDiff = Math.Abs(read.GetDouble(1) - anchorAtlasY);
yDiff = Math.Abs((read.GetDouble(1) - anchorAtlasJ));
Double yDiffMeters = yDiff / pixelsPerMeter;
//virt = (read.GetBoolean(2));
//Debug.Log("virt flag: " + virt);
//if (read.GetDouble(0) > anchorAtlasX)
if (read.GetDouble(0) > anchorAtlasI) {
//xNewPos = anchorUnityX + xDiff;
xNewPos = anchorUnityX + xDiffMeters;
}
else {
//xNewPos = anchorUnityX - xDiff;
xNewPos = anchorUnityX - xDiffMeters;
}
//if (read.GetDouble(1) > anchorAtlasY)
if (read.GetDouble(1) > anchorAtlasJ) {
//yNewPos = anchorUnityY - yDiff;
yNewPos = anchorUnityY - yDiffMeters;
}
else {
//yNewPos = anchorUnityY + yDiff;
yNewPos = anchorUnityY + yDiffMeters;
}
// Vector of NewPoint
newPos = new Vector3((float)xNewPos, (float)transform.position.y, (float)yNewPos);
//Debug.Log("New Vector3: " + newPos.x + ", " + newPos.y + ", " + newPos.z);
// Actual transform (movement) code is in update() as that runs every frame whereas this method only runs every x seconds (it's a coroutine with WaitForSeconds at the end)
}
}
}
}
}
catch (Exception e) {
Debug.Log(e.ToString());
}
//Debug.Log("DB query on: " + System.DateTime.Now);
yield return new WaitForSeconds(seconds);
}
}
示例11: getDouble
public static double? getDouble(MySqlDataReader dr, string column)
{
int ordinal = dr.GetOrdinal(column);
if (dr.IsDBNull(ordinal))
{
return null;
}
else
{
return dr.GetDouble(ordinal);
}
}
示例12: Tube_Control
public void Tube_Control(TreeViewItem item)
{
try
{
if (item.Tag.ToString() == "tube0" || item.Tag.ToString() == "tube1")
{
Mouse.OverrideCursor = Cursors.Wait;
_mySqlCommand.CommandText = @"
SELECT
defectsdata.IndexData,
defectsdata.NumberPart,
defectsdata.NumberTube,
defectsdata.NumberSegments,
defectsdata.DataSensors,
DATE_FORMAT(defectsdata.DatePr, '%Y-%m-%d'),
defectsdata.TimePr,
worksmens.NameSmen,
o1.Surname,
o2.Surname
FROM
defectsdata
INNER JOIN indexes ON indexes.IndexData = defectsdata.IndexData
INNER JOIN worksmens ON worksmens.Id_WorkSmen = indexes.Id_WorkSmen
INNER JOIN operators o1 ON o1.Id_Operator = indexes.Id_Operator1
INNER JOIN operators o2 ON o2.Id_Operator = indexes.Id_Operator2
WHERE
defectsdata.IndexData = @A
LIMIT 1
";
_mySqlCommand.Parameters.Clear();
_mySqlCommand.Parameters.AddWithValue("A", item.Uid);
_mySqlCommand.Connection = _connection.MySqlConnection;
_mySqlDataReader = _mySqlCommand.ExecuteReader();
while (_mySqlDataReader.Read())
{
ArchiveWindow.label1.Content = "Номер плавки\t" + _mySqlDataReader.GetString(1);
ArchiveWindow.label2.Content = "Номер трубы\t" + _mySqlDataReader.GetString(2);
ArchiveWindow.label3.Content = "Дата проведения Н.К.\t" + _mySqlDataReader.GetString(5);
ArchiveWindow.label4.Content = "Время проведения Н.К.\t" + _mySqlDataReader.GetString(6);
ArchiveWindow.label5.Content = "Длина трубы (метры)\t\t " +
Math.Round((_mySqlDataReader.GetDouble(3)/6), 2);
ArchiveWindow.label7.Content = "Рабочая смена\t" + _mySqlDataReader.GetString(7);
ArchiveWindow.label8.Content = "Специалист ОКПП\t" + _mySqlDataReader.GetString(9);
ArchiveWindow.label9.Content = "Специалист АСК ТЭСЦ-2\t" + _mySqlDataReader.GetString(8);
for (var i = 0; i < _countDeffectsLine; i++)
{
var line = (Line) ArchiveWindow.canvas1.FindName("errorLine" + i);
ArchiveWindow.canvas1.Children.Remove(line);
try
{
ArchiveWindow.canvas1.UnregisterName("errorLine" + i);
}
// ReSharper disable EmptyGeneralCatchClause
catch
// ReSharper restore EmptyGeneralCatchClause
{
}
}
_countDeffectsLine = 0;
/*_mySqlDataReaderValue4 = _mySqlDataReader.GetValue(4);
_da.Completed += _da_Completed;
_da.From = ArchiveWindow.rectangle1.Width;
_da.To = _mySqlDataReader.GetDouble(3)*4;
_da.Duration = TimeSpan.FromMilliseconds(500);
ArchiveWindow.rectangle1.BeginAnimation(FrameworkElement.WidthProperty, _da);*/
ArchiveWindow.rectangle1.Width = _mySqlDataReader.GetDouble(3)*4;
var j = 0;
foreach (var deffect in (byte[]) _mySqlDataReader.GetValue(4))
{
if (deffect != 0)
{
var redBrush = new SolidColorBrush
{
Color = Colors.Red
};
var errorLine = new Line();
Canvas.SetLeft(errorLine, 40 + (j*4));
errorLine.Opacity = 1;
errorLine.X1 = 0;
errorLine.X2 = 0;
errorLine.Y1 = 151;
errorLine.Y2 = 151 + 70;
errorLine.StrokeThickness = 4;
errorLine.Stroke = redBrush;
errorLine.Fill = redBrush;
ArchiveWindow.canvas1.RegisterName("errorLine" + _countDeffectsLine, errorLine);
ArchiveWindow.canvas1.Children.Add(errorLine);
/*_da1.From = 0;
_da1.To = 1;
_da1.Duration = TimeSpan.FromMilliseconds(2000);
errorLine.BeginAnimation(UIElement.OpacityProperty, _da1);*/
_countDeffectsLine++;
//.........这里部分代码省略.........
示例13: Change
public void Change(string columnas, string bd, int rB)
{
query = "SELECT " + columnas + " FROM " + bd + " WHERE Codigo = '" + cb_Agregar.Text + "';";
try
{
if (rB == 1)
{
con = new MySqlConnection(constring);
cmd = new MySqlCommand(query, con);
con.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
string Codigo = reader.GetString("Codigo");
string Descripcion = reader.GetString("Descripcion");
string Unidad = reader.GetString("Unidad");
double Costo = reader.GetDouble("Costo");
double Rendimiento = reader.GetDouble("Rendimiento");
double Importe = reader.GetDouble("Importe");
txtCodigo.Text = Codigo;
txtDesc.Text = Descripcion;
txtUnidad.Text = Unidad;
txtCosto.Text = Costo.ToString("0.##");
}
con.Close();
lbl_Ocupacion.Visible = false;
lbl_Descripcion.Visible = true;
lbl_Sueldo.Visible = false;
lbl_Costo.Visible = true;
lbl_Salario.Visible = false;
lbl_CostoHr.Visible = false;
}
else
if (rB == 2)
{
con = new MySqlConnection(constring);
cmd = new MySqlCommand(query, con);
con.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
string Codigo = reader.GetString("Codigo");
string ocupacion = reader.GetString("Ocupacion");
double Sueldo = reader.GetDouble("SueldoSemVig");
double Salario = reader.GetDouble("SalarioTotal");
double Rendimiento = reader.GetDouble("Rendimiento");
double Importe = reader.GetDouble("Importe");
txtCodigo.Text = Codigo;
txtDesc.Text = ocupacion;
txtUnidad.Text = Sueldo.ToString("0.##");
txtCosto.Text = Salario.ToString("0.##");
}
con.Close();
lbl_Ocupacion.Visible = true;
lbl_Descripcion.Visible = false;
lbl_Sueldo.Visible = true;
lbl_Costo.Visible = false;
lbl_Salario.Visible = true;
lbl_CostoHr.Visible = false;
}
else
if (rB == 3)
{
con = new MySqlConnection(constring);
cmd = new MySqlCommand(query, con);
con.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
string Codigo = reader.GetString("Codigo");
string Descripcion = reader.GetString("Descripcion");
string Unidad = reader.GetString("Unidad");
double Costo = reader.GetDouble("CostoHr");
double Rendimiento = reader.GetDouble("Rendimiento");
double Importe = reader.GetDouble("Importe");
txtCodigo.Text = Codigo;
txtDesc.Text = Descripcion;
txtUnidad.Text = Unidad;
txtCosto.Text = Costo.ToString("0.##");
}
con.Close();
lbl_Ocupacion.Visible = false;
lbl_Descripcion.Visible = true;
lbl_Sueldo.Visible = false;
lbl_Costo.Visible = false;
lbl_Salario.Visible = false;
lbl_CostoHr.Visible = true;
}
}
catch
{
MessageBox.Show("Error en la conexión de la Base de Datos", "Ocurrió un error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例14: Unique_GetListOfIds
public List<string> Unique_GetListOfIds(string table)
{
List<string> idList = new List<string>();
cmd = new MySqlCommand("SELECT distinct(id) FROM " + Database + "." + table, connection);
reader = cmd.ExecuteReader();
while (reader.Read())
{
idList.Add(reader.GetDouble(0).ToString());
}
reader.Close();
return idList;
}
示例15: SetFromSql
/// <summary>
/// Populate object from database record
/// </summary>
/// <param name="reader">
/// A <see cref="MySqlDataReader"/>
/// </param>
public void SetFromSql(MySqlDataReader reader)
{
for (int i = 0; i < reader.FieldCount; i++) {
switch (reader.GetName(i)) {
case "id": Id = reader.GetInt64(i); break;
case "name": Name = reader.GetString(i); break;
case "fullname": FullName = reader.GetString(i); break;
case "sha1_hash": sha1Hash = reader.GetString(i); break;
case "directory_id": DirectoryId = reader.GetInt64(i); break;
case "mimetype": Mimetype = reader.GetString(i); break;
case "title":
Title = DB.IsNull(reader[i]) ? null : reader.GetString(i);
break;
case "description":
Description = DB.IsNull(reader[i]) ? null : reader.GetString(i);
break;
case "copyright":
Copyright = DB.IsNull(reader[i]) ? null : reader.GetString(i);
break;
case "width": Width = reader.GetInt32(i); break;
case "height": Height = reader.GetInt32(i); break;
case "size": Size = reader.GetInt64(i); break;
case "resolution": Resolution = reader.GetDouble(i); break;
case "exif":
Exif = DB.IsNull(reader[i]) ? null : reader.GetString(i);
break;
case "created": Created = reader.GetDateTime(i); break;
case "modified":
if (!DB.IsNull(reader[i]))
Modified = reader.GetDateTime(i);
break;
case "keywords":
Keywords = DB.IsNull(reader[i]) ? null : reader.GetString(i);
break;
}
}
if (Id > 0) {
using (var db = new DbManager(Manager.DbCon)) {
var sql = "SELECT * FROM `preview` WHERE [email protected]";
if (db.QueryReader(sql, DB.Param("id", Id))) {
while (db.DataReader.NextResult()) {
db.DataReader.Read();
Previews.Add(PreviewFile.FromSql(db.DataReader));
}
}
}
}
}