VB.NET SQL DATA READER

Full screen VB.NET Topic list Dim myField As DataRow Dim myProperty As DataColumn 'Open a connection to the SQL Server Northwind database. cn.ConnectionString = "Data Source=server;User Id=login;" & _ "Password=password;Initial Catalog=Northwind;" cn.Open() 'Retrieve records from the Employees table into a DataReader. cmd.Connection = cn cmd.CommandText = "SELECT * FROM Employees" myReader = cmd.ExecuteReader(CommandBehavior.KeyInfo) 'Retrieve column schema into a DataTable. schemaTable = myReader.GetSchemaTable() 'For each field in the table... For Each myField In schemaTable.Rows 'For each property of the field... For Each myProperty In schemaTable.Columns 'Display the field name and value. Console.WriteLine(myProperty.ColumnName & " = " & myField(myProperty).ToString()) Next Console.WriteLine() 'Pause. Console.ReadLine() Next 'Always close the DataReader and Connection objects. myReader.Close() cn.Close() https://support.microsoft.com/en-gb/kb/310108 Copyright © 2015-19 Allied Factors Limited. All Rights Reserved.