本文整理汇总了C#中MySql.Data.MySqlClient.MySqlDataReader类的典型用法代码示例。如果您正苦于以下问题:C# MySqlDataReader类的具体用法?C# MySqlDataReader怎么用?C# MySqlDataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MySqlDataReader类属于MySql.Data.MySqlClient命名空间,在下文中一共展示了MySqlDataReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TableInformations
public TableInformations(MySqlDataReader reader)
{
_primaryKey = new List<string>();
_uniqueConstraints = new List<string>();
_foreignConstraints = new List<string>();
this.setProperty(reader);
}
示例2: show
public static void show(MySqlDataReader mySqlDataReader)
{
// METODO QUE MUESTRA TODO EL CONETNIDO DE LA TABLA
Console.WriteLine ("FILAS : "); // EL SHOW MUESTRA EL SHOWROW (FILA). EL SHOWROW MUESTRA LA FILA
while (mySqlDataReader.Read())
showRow (mySqlDataReader);
}
示例3: GetGameFromDataReader
protected Game GetGameFromDataReader(MySqlDataReader dataReader)
{
string gameNaam = dataReader.GetString("gamenaam");
int gameId = dataReader.GetInt32("game_id");
Game game = new Game { ID = gameId, Naam = gameNaam };
return game;
}
示例4: InitFromData
public void InitFromData(MySqlDataReader reader)
{
Id = (int)reader["id"];
Ip = (string)reader["ip"];
Port = (int)reader["port"];
Status = ServerStatusEnum.OFFLINE;
}
示例5: readerToRobaDTO
public static RobaDTO readerToRobaDTO(MySqlDataReader reader)
{
RobaDTO roba = new RobaDTO();
roba.SifraRoba = reader.GetInt32("SifraRoba");
roba.Naziv = reader.GetString("Naziv");
return roba;
}
示例6: DataReaderToDataTable
public System.Data.DataTable DataReaderToDataTable(MySqlDataReader Reader)
{
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataColumn dc;
System.Data.DataRow dr;
ArrayList arr = new ArrayList();
int i;
for(i=0;i<Reader.FieldCount;i++)
{
dc = new System.Data.DataColumn();
dc.ColumnName = Reader.GetName(i);
arr.Add(dc.ColumnName);
dt.Columns.Add(dc);
}
while(Reader.Read())
{
dr = dt.NewRow();
for (i=0;i<Reader.FieldCount;i++)
{
dr[(string)arr[i]] = Reader[i].ToString();
}
dt.Rows.Add(dr);
}
Reader.Close();
return dt;
}
示例7: GetSchemaForQuery
/// <summary>
/// Gets schema from reader taking Query.ResultRowType in consideration
/// </summary>
public static Schema GetSchemaForQuery(string target, Query query, MySqlDataReader reader, QuerySource qSource, out Schema.FieldDef[] toLoad)
{
Schema schema;
var rtp = query.ResultRowType;
if (rtp != null && typeof(TypedRow).IsAssignableFrom(rtp))
schema = Schema.GetForTypedRow(query.ResultRowType);
else
schema = GetSchemaFromReader(query.Name, qSource, reader);
//determine what fields to load
toLoad = new Schema.FieldDef[reader.FieldCount];
for (int i = 0; i < reader.FieldCount; i++)
{
var name = reader.GetName(i);
var fdef = schema[name];
//todo A gde GetBackendNameFor target?
if (fdef==null) continue;
var attr = fdef[target];
if (attr!=null)
{
if (attr.StoreFlag!=StoreFlag.LoadAndStore && attr.StoreFlag!=StoreFlag.OnlyLoad) continue;
}
toLoad[i] = fdef;
}
return schema;
}
示例8: show
private static void show(MySqlDataReader mySqlDataReader)
{
Console.WriteLine ("show");
while (mySqlDataReader.Read()) {
showRow (mySqlDataReader);
}
}
示例9: readerToStatusFilmDTO
public static StatusFilmDTO readerToStatusFilmDTO(MySqlDataReader reader)
{
StatusFilmDTO status = new StatusFilmDTO();
status.Id = reader.GetInt32("idStatusFilm");
status.Naziv = reader["nazivStatusFilm"].ToString();
return status;
}
示例10: getColumnNames
//metodo que devuelve un array con el nombre de las columnas de la tabla que contiene el mySqlDataReader
private string[] getColumnNames(MySqlDataReader mySqlDataReader)
{
List<string> columnNames = new List<string>();//Lista de valores que almacenara el nombre de las columnas de la tabla en la base de datos
for (int index = 0; index < mySqlDataReader.FieldCount; index++)//se obtienen del mySqlDataReader el nombre de las columnas
columnNames.Add (mySqlDataReader.GetName (index));//se añade el nombre a la lista
return columnNames.ToArray ();
}
示例11: findAll
public void findAll()
{
db = new Database();
brands.Clear();
brandQuery = new MySqlCommand();
brandQuery.Connection = db.Connection();
brandQuery.CommandText = "SELECT * FROM brand ORDER BY brandname ASC";
this.brandResult = brandQuery.ExecuteReader();
while (brandResult.Read())
{
if (!brandResult.IsDBNull(0))
{
idbrand = brandResult.GetInt32(0);
}
if (!brandResult.IsDBNull(1))
{
brandname = brandResult.GetString(1);
}
brands.Add(new Brand { idbrand = this.idbrand, brandname = this.brandname});
}
db.Close();
}
示例12: button1_Click
private void button1_Click(object sender, EventArgs e)
{
string pwss = textBox1.Text.ToString();
string confirm = textBox2.Text.ToString();
if (pwss == confirm)
{
if (this.textBox3.Text.ToString() == usuario_activo.pw)
{
sentenciaSQL = "UPDATE sql28127.usuarios SET pw='" + this.textBox2.Text + "' where id_usuario= '" + usuario_activo.id + "' ;";
// sentenciaSQL = "UPDATE test.usuarios SET pw='" + this.textBox2.Text + "' where id_usuario= '" + usuario_activo.id + "' ;";
comando = new MySqlCommand(sentenciaSQL, conexion);
resultado = comando.ExecuteReader();
MessageBox.Show("Cambio completado", "Aceptado");
this.Close();
Form3 principal = new Form3();
principal.Show();
}
else
{
MessageBox.Show("Tercer campo \"Repetir Contraseña\" erroneo", "ERROR");
}
}
else
{
MessageBox.Show("Igualar Contraseñas", "ERROR");
}
}
示例13: CheckNameAndPasswd
//when check name and password, get the user's information
public PropertyClass CheckNameAndPasswd(string name,string password)
{
PropertyClass accountClass=null;
string strSql="select * from account where accountName='"+name.Trim()+"' and accountPassword='"+password.Trim()+"'";
try{
sdr=db.GetDataReader(strSql);
sdr.Read();
if(sdr.HasRows)
{
accountClass=new PropertyClass();
accountClass.UserId=sdr.GetInt32("id");
accountClass.AccountName=name.Trim();
accountClass.AccountPassword=password.Trim();
accountClass.Email=sdr["email"].ToString();
accountClass.Job=sdr.GetInt32("job");;
accountClass.Superviser=sdr.GetInt32("superviser");
}
}
catch(Exception ex)
{
}
finally
{
sdr.Close();
}
return accountClass;
}
示例14: IsNameExist
public bool IsNameExist(string name)
{
string strSql="select * from account where accountName='"+name.Trim()+"'";
try{
sdr=db.GetDataReader(strSql);
sdr.Read();
if(sdr.HasRows)
{
sdr.Close();
return true;
}
else
{
sdr.Close();
return false;
}
}
catch(Exception e)
{
}
finally
{
sdr.Close();
}
return true;
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
topics_ids = new ArrayList();
dbConnection = new MySqlConnection(ConfigurationManager.AppSettings["ConnectionString"].ToString());
dbConnection.Open();
slctTopics = new MySqlCommand("SELECT t_id FROM topics", dbConnection);
dReaderTopics = slctTopics.ExecuteReader();
while (dReaderTopics.Read())
{
topics_ids.Add(dReaderTopics[0].ToString());
counter++;
}
dReaderTopics.Close();
slctTopics.Dispose();
while (i < counter)
{
updtTopicsNumberOfVideos = new MySqlCommand("UPDATE topics SET t_nb_videos=(SELECT count(*) FROM videos WHERE t_id=" + topics_ids[i].ToString() + ") WHERE t_id=" + topics_ids[i].ToString(), dbConnection);
updtTopicsNumberOfVideos.ExecuteNonQuery();
updtTopicsNumberOfVideos.Dispose();
i++;
}
}