當前位置: 首頁>>代碼示例>>C#>>正文


C# MySqlDataReader.GetName方法代碼示例

本文整理匯總了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 (" ");
     }
 }
開發者ID:Dorowk,項目名稱:AD,代碼行數:9,代碼來源:Program.cs

示例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 { }
        }
開發者ID:fmontezuma,項目名稱:fmontezuma,代碼行數:31,代碼來源:Entregador.cs

示例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 { }
        }
開發者ID:fmontezuma,項目名稱:fmontezuma,代碼行數:60,代碼來源:Fornecedor.cs

示例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);
             }
            */
        }
開發者ID:jmollaf,項目名稱:ad,代碼行數:26,代碼來源:Program.cs

示例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;
		}
開發者ID:marioricci,項目名稱:erp-luma,代碼行數:32,代碼來源:DataClass.cs

示例6: showColumNames

 private static void showColumNames(MySqlDataReader mySqlDataReader)
 {
     for (int i = 0; i < mySqlDataReader.FieldCount; i++) {
         Console.WriteLine ("Columna: " + mySqlDataReader.GetName (i));
     }
     Console.WriteLine (" ");
 }
開發者ID:oscargarciagarcia,項目名稱:ad,代碼行數:7,代碼來源:Program.cs

示例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("====================================================");
 }
開發者ID:vasialek,項目名稱:ajwa,代碼行數:8,代碼來源:DbHelper.cs

示例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;
 }
開發者ID:luisso96,項目名稱:ad,代碼行數:8,代碼來源:Program.cs

示例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+" ");
     }
 }
開發者ID:khadeon,項目名稱:AD,代碼行數:8,代碼來源:Program.cs

示例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();
 }
開發者ID:JoanJSimpson,項目名稱:ad,代碼行數:8,代碼來源:Program.cs

示例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;
 }
開發者ID:ruben206,項目名稱:ad,代碼行數:8,代碼來源:Main.cs

示例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;
 }
開發者ID:ruben206,項目名稱:ad,代碼行數:8,代碼來源:Main.cs

示例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;
 }
開發者ID:orgimeno,項目名稱:ad,代碼行數:8,代碼來源:Program.cs

示例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;
 }
開發者ID:nerea123,項目名稱:ad,代碼行數:8,代碼來源:Main.cs

示例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;
 }
開發者ID:nerea123,項目名稱:ad,代碼行數:9,代碼來源:Main.cs


注:本文中的MySql.Data.MySqlClient.MySqlDataReader.GetName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。