
Untitled
By: a guest on
Apr 15th, 2010 | syntax:
VB.NET | size: 1.29 KB | hits: 259 | expires: Never
Imports System.Data.SqlClient
Module Module1
Sub Main(ByVal sArgs() As String)
Dim SQLStr As String
Dim ConnString As String
'Connstring = Server Name, Database Name, Windows Authentication
ConnString = "Data Source=MATHEW-PC\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True"
SQLStr = "SELECT Name from RSSFEEDS"
'Write to SQL
Dim SQLConn As New SqlConnection() 'The SQL Connection
Dim SQLCmd As New SqlCommand() 'The SQL Command
Dim SQLdr As SqlDataReader 'The Local Data Store
SQLConn.ConnectionString = ConnString 'Set the Connection String
SQLConn.Open() 'Open the connection
' Create Data Adapter
Dim da As New SqlDataAdapter(SQLStr, SQLConn)
' Create and fill Dataset
Dim ds As New DataSet
da.Fill(ds, "Employee")
' Get Data Table
Dim dt As DataTable = ds.Tables("Employee")
'Display Data
For Each row As DataRow In dt.Rows
For Each col As DataColumn In dt.Columns
Console.WriteLine(row(col))
Next
Next
SQLConn.Close() 'Close the connection
SQLConn.Dispose()
Console.ReadLine()
End Sub
End Module