Skip to content
Newer
Older
100644 44 lines (33 sloc) 1.43 KB
159371f @issyl0 Add the VB COMP4 coursework code, for the fun of it.
authored
1 Imports System.Data
2 Imports System.Data.OleDb
3
4 Public Class frmReportSurvey
5
6 Private Sub frmReportSurvey_Load(ByVal sender As System.Object, _
7 ByVal e As System.EventArgs) Handles MyBase.Load
8 Dim cmdString As String = "SELECT cust_name FROM Customer"
9 'check if db connection is breathing
10 'if it isn't, resuscitate it :)
11 If frmLoginForm.accConnection.State <> ConnectionState.Open Then
12 frmLoginForm.accConnection.Open()
13 End If
14 Dim accConnection As OleDbConnection = frmLoginForm.accConnection
15 Dim da As New OleDbDataAdapter(cmdString, accConnection)
16 Dim ds As New DataSet
17
18 da.Fill(ds, "Customer")
19
20 Dim dt As DataTable = ds.Tables(0)
21 Dim dr As DataRow
22
23 For Each dr In dt.Rows()
24 txtcbReportSurvey.Items.Add(dr("cust_name"))
25 Next
26
27 txtcbReportSurvey.SelectedIndex = -1
28
29 End Sub
30
31
32 Private Sub btnOK_Click(ByVal sender As System.Object, _
33 ByVal e As System.EventArgs) Handles btnOK.Click
34
35 Dim custname As String = txtcbReportSurvey.SelectedItem
36 frmSurveyForm.Show()
37 End Sub
38
39 Private Sub btnCancel_Click(ByVal sender As System.Object, _
40 ByVal e As System.EventArgs) Handles btnCancel.Click
41 Me.Close()
42 frmReportMenu.Show()
43 End Sub
44 End Class
Something went wrong with that request. Please try again.