Advertisement
4_2005-2006 Files/ File Controls/ Input/ Output #155783

_Console Menu Foundation Class

This is a console menu foundation class. This allows you to create menus in seconds! Methods include: AddMenu(int ID, char *Name); AddItem(int ID, char *Name, void (*Function)()); Draw(); Run(); ...

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Upload
How to use a System.Data.SqlClient.SqlDataReader
I have inserted ... at the begining of each line so that it is readable...
.
.
.' I Used the frmMain Load sub as an example.
.
.Private Sub frmMain_Load(ByVal Sender As Object, ByVal e As EventArgs) Handles MyBase.load
'Dim all the needed vars
....Dim DR As System.Data.SqlClient.SqlDataReader
....Dim strSQL As String = "SELECT * FROM Users"
....Dim SqlConn As new System.Data.SqlClient.SqlConnection("Persist Security Info=False;Data Source=localhost;Initial Catalog=MyDb;User ID=sa;Password=;")
'Open the Database
....SqlConn.open()
....Dim SqlComm As new System.Data.SqlClient.SqlCommand(strSQL, SqlConn)
'Execute the reader
....DR = SqlComm.ExecuteReader
'Loop through the records and add the "UserName" to a text box
....Do While DR.Read()
.......txtUserNames.Text &= VbCrLf & DR.Item("UserName")
....Loop
'Close everything
....DR.Close()
....SqlConn.Close()
....SqlComm.Dispose()
....SqlConn.Dispose()
'setting the values to nothing is not required but I like to do it anyway
....DR = Nothing
....SqlConn = Nothing
....SqlComm = Nothing
'and thats it
.End Sub
Original Comments (3)
Recovered from Wayback Machine