本文整理汇总了C#中MySql.Data.MySqlClient.MySqlDataReader.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDataReader.GetName方法的具体用法?C# MySqlDataReader.GetName怎么用?C# MySqlDataReader.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql.Data.MySqlClient.MySqlDataReader
的用法示例。
在下文中一共展示了MySqlDataReader.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: show
private static void show(MySqlDataReader reader)
{
while (reader.Read()){
for (int i =0; i< reader.FieldCount; i++) {
Console.Write ("{0} = {1} ", reader.GetName (i), reader [reader.GetName (i)]);
}
Console.WriteLine (" ");
}
}
示例2: 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 { }
}
示例3: Fornecedor
public Fornecedor(MySqlDataReader rs)
{
try
{
int i = 0;
while (true)
{
switch (rs.GetName(i))
{
case "cnpj":
this.cnpj = rs.GetString(i);
break;
case "nome":
this.nome = rs.GetString(i);
break;
case "endereco_rua":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Rua = rs.GetString(i);
break;
case "endereco_numero":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Numero = rs.GetString(i);
break;
case "endereco_complemento":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Complemento = rs.GetString(i);
break;
case "endereco_bairro":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Bairro = rs.GetString(i);
break;
case "endereco_cep":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Cep = rs.GetString(i);
break;
case "endereco_cidade":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Cidade = rs.GetString(i);
break;
case "endereco_estado":
if (this.endereco == null) this.endereco = new model.Endereco();
this.endereco.Estado = rs.GetString(i);
break;
case "telefone_ddd":
if (this.telefone == null) this.telefone = new model.Telefone();
this.telefone.Ddd = rs.GetString(i);
break;
case "telefone_tel":
if (this.telefone == null) this.telefone = new model.Telefone();
this.telefone.Numero = rs.GetString(i);
break;
default:
throw new Exception("Propriedade não encontrada");
}
i++;
}
}
catch { }
}
示例4: showColumnNames
private static void showColumnNames(MySqlDataReader mySqlDataReader)
{
//SOLUCION MIA
int numeroColumnas = mySqlDataReader.FieldCount;
for (int i=0;i<numeroColumnas;i++)
{
Console.Write (mySqlDataReader.GetName(i) + " ");
}
/*SOLUCION PROFESOR 1
Console.WriteLine ("showColumnNames...");
for (int index = 0; index < mySqlDataReader.FieldCount; index++) {
Console.WriteLine ("index=" + index + " columna=" + mySqlDataReader.GetName (index));
}
*/
/*SOLUCION PROFESOR 2 CON ARRAY
int count= mySqlDataReader.FieldCount;
string[] columNames = new string[count];
for(int index =0; index <count; index++){
columNames [index] = mySqlDataReader.GetName (index);
}
foreach (string columnName in columnNames){
console.WriteLine ("Columna=" +columnName);
}
*/
}
示例5: 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;
}
示例6: showColumNames
private static void showColumNames(MySqlDataReader mySqlDataReader)
{
for (int i = 0; i < mySqlDataReader.FieldCount; i++) {
Console.WriteLine ("Columna: " + mySqlDataReader.GetName (i));
}
Console.WriteLine (" ");
}
示例7: debugvar
public static void debugvar(MySqlDataReader dataReader)
{
for (int i = 0; i < dataReader.FieldCount; i++)
{
Console.WriteLine("[" + dataReader.GetName(i) + "] = " + dataReader[i]);
}
Console.WriteLine("====================================================");
}
示例8: getColumnNames
private static string[] getColumnNames(MySqlDataReader mySqlDataReader)
{
int count = mySqlDataReader.FieldCount;
string[] columnNames = new string[count];
for (int i = 0; i < count; i++)
columnNames [i] = mySqlDataReader.GetName (i);
return columnNames;
}
示例9: showColumnNames
private static void showColumnNames(MySqlDataReader mySqlDataReader)
{
String columnName = "";
for (int i=0; i<mySqlDataReader.FieldCount; i++) {
columnName = mySqlDataReader.GetName (i);
Console.WriteLine ("posicion "+i+ " = "+columnName+" ");
}
}
示例10: getColumnNames
public static string[] getColumnNames(MySqlDataReader mySqlDataReader)
{
int count = mySqlDataReader.FieldCount;
List<string> columnNames = new List<string> ();
for (int index = 0; index < count; index++)
columnNames.Add (mySqlDataReader.GetName (index));
return columnNames.ToArray();
}
示例11: getColumnNames2
private static IEnumerable<string> getColumnNames2(MySqlDataReader mySqlDataReader)
{
int fieldCount = mySqlDataReader.FieldCount;
List<string> columnNames = new List<string>();
for (int index = 0; index < fieldCount; index++)
columnNames.Add ( mySqlDataReader.GetName(index) );
return columnNames;
}
示例12: getColumnNames
private static IEnumerable<string> getColumnNames(MySqlDataReader mySqlDataReader)
{
int fieldCount = mySqlDataReader.FieldCount;
string[] columnNames = new string[ fieldCount ];
for (int index = 0; index < fieldCount; index++)
columnNames[index] = mySqlDataReader.GetName (index);
return columnNames;
}
示例13: showColumnNames
private static string[] showColumnNames(MySqlDataReader mysqldatareader)
{
int columns = mysqldatareader.FieldCount;
string[] columnasNombre = new string[columns];
for (int i=columns-1; i>=0; i--)
columnasNombre[i] = mysqldatareader.GetName (i);
return columnasNombre;
}
示例14: getcolumNames2
private static IEnumerable<string> getcolumNames2(MySqlDataReader mysqlDataReader)
{
int numCol=mysqlDataReader.FieldCount;
List<string> columNames= new List<string>();
for(int i=0;i<numCol;i++)
columNames.Add(mysqlDataReader.GetName(i));
return columNames;
}
示例15: getcolumNames
private static IEnumerable<string> getcolumNames(MySqlDataReader mysqlDataReader)
{
string[] names=new string [mysqlDataReader.FieldCount];
int numCol=mysqlDataReader.FieldCount;
for(int i=0;i<numCol;i++){
names[i]=mysqlDataReader.GetName(i);
}
return names;
}