Hi im stuck with my assignment and would appreciate some help
question:Company ‘PRINTERS-4-U’ is a small local shop selling a range of computer printers.
The company wishes to develop a management information retrieval system.
The application should start up with a splash screen. Management should be able to log onto the system and display information held in the stored database. You should also demonstrate that you have used a range of data validation techniques in the application.
As a minimum the management will require.
1. Display ALL printers in stock, by item number and by manufacturer and by platform - three lists required. (use a Data Grid or number of Data Grid controls)
2. Display details of printers from a selected manufacture or for a selected use. i.e ‘use - Business’ or use – ‘Photographs’. Use a list control)
3. Display the details of a printer based upon the name of the printer. e.g. ‘EPSON PHOTO R285’. (use a text box to input the name of the printer).
4. Display details of printers for at least three other criteria. e.g. ‘ink jet’, ‘USB’, ‘price range £50 - £75’ (use a combo control to hold the criteria and display the results in a list control)
5. Update the cost of a printer (use a text box to input the new cost of the printer.)
6. Delete all details of a selected printer.
7. Delete all printers for a select manufacturer
8. Add a new printer to the database (use text boxes, not a Data Grid control)
9. You are free to add other sensible management facilities.
I have to have a logon screen with passwords, how would i go about doing that or any help on tutorials that will help me do it. Also i am getting an error with "da.Update(ds, "PrinterData")"
CODE
Imports System.Data
Public Class Form1
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim inc As Integer
Dim MaxRows As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnload.Click
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Printers4u.mdb"
con.Open()
sql = "select * from tblPrinter"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "PrinterData")
MsgBox("A Connection to the Database is now open")
con.Close()
PrinterIDtxt.Text = ds.Tables("PrinterData").Rows(0).Item(0)
PrinterNametxt.Text = ds.Tables("PrinterData").Rows(0).Item(1)
PrinterTypetxt.Text = ds.Tables("PrinterData").Rows(0).Item(2)
Pricetxt.Text = ds.Tables("PrinterData").Rows(0).Item(3)
StockLevelstxt.Text = ds.Tables("PrinterData").Rows(0).Item(4)
ManufacturerIDtxt.Text = ds.Tables("PrinterData").Rows(0).Item(5)
ManufacturerNametxt.Text = ds.Tables("PrinterData").Rows(0).Item(6)
Addresstxt.Text = ds.Tables("PrinterData").Rows(0).Item(7)
MaxRows = ds.Tables("PrinterData").Rows.Count
inc = -1
MsgBox("The Connection to the Database is now Closed")
End Sub
Private Sub NavigateRecords()
PrinterIDtxt.Text = ds.Tables("PrinterData").Rows(inc).Item(0)
PrinterNametxt.Text = ds.Tables("PrinterData").Rows(inc).Item(1)
PrinterTypetxt.Text = ds.Tables("PrinterData").Rows(inc).Item(2)
Pricetxt.Text = ds.Tables("PrinterData").Rows(inc).Item(3)
StockLevelstxt.Text = ds.Tables("PrinterData").Rows(inc).Item(4)
ManufacturerIDtxt.Text = ds.Tables("PrinterData").Rows(inc).Item(5)
ManufacturerNametxt.Text = ds.Tables("PrinterData").Rows(inc).Item(6)
Addresstxt.Text = ds.Tables("PrinterData").Rows(inc).Item(7)
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
If inc <> MaxRows - 1 Then
inc = inc + 1
NavigateRecords()
End If
End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
Else
MsgBox("First Record")
End If
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
End If
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
End If
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("PrinterData").Rows(inc).Item(0) = PrinterIDtxt.Text
ds.Tables("PrinterData").Rows(inc).Item(1) = PrinterNametxt.Text
ds.Tables("PrinterData").Rows(inc).Item(2) = PrinterTypetxt.Text
ds.Tables("PrinterData").Rows(inc).Item(3) = Pricetxt.Text
ds.Tables("PrinterData").Rows(inc).Item(4) = StockLevelstxt.Text
ds.Tables("PrinterData").Rows(inc).Item(5) = ManufacturerIDtxt.Text
ds.Tables("PrinterData").Rows(inc).Item(6) = ManufacturerNametxt.Text
ds.Tables("PrinterData").Rows(inc).Item(7) = Addresstxt.Text
MsgBox("Data updated")
End Sub
Private Sub btnAddNewRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNewRecord.Click
btnCommit.Enabled = True
btnAddNewRecord.Enabled = False
btnUpdate.Enabled = False
btnDelete.Enabled = False
PrinterIDtxt.Clear()
PrinterNametxt.Clear()
PrinterTypetxt.Clear()
Pricetxt.Clear()
StockLevelstxt.Clear()
ManufacturerIDtxt.Clear()
ManufacturerNametxt.Clear()
Addresstxt.Clear()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
btnCommit.Enabled = False
btnAddNewRecord.Enabled = True
btnUpdate.Enabled = True
btnDelete.Enabled = True
inc = 0
NavigateRecords()
End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("PrinterData").Rows(inc).Delete()
MaxRows = MaxRows - 1
inc = 0
NavigateRecords()
da.Update(ds, "PrinterData")
End Sub
Private Sub btnCommit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCommit.Click
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("PrinterData").NewRow()
dsNewRow.Item(0) = PrinterIDtxt.Text
dsNewRow.Item(1) = PrinterNametxt.Text
dsNewRow.Item(2) = PrinterTypetxt.Text
dsNewRow.Item(3) = Pricetxt.Text
dsNewRow.Item(4) = StockLevelstxt.Text
dsNewRow.Item(5) = ManufacturerIDtxt.Text
dsNewRow.Item(6) = ManufacturerNametxt.Text
dsNewRow.Item(7) = Addresstxt.Text
ds.Tables("PrinterData").Rows.Add(dsNewRow)
da.Update(ds, "PrinterData")
MsgBox("New Record added to the Database")
btnCommit.Enabled = False
btnAddNewRecord.Enabled = True
btnUpdate.Enabled = True
btnDelete.Enabled = True
End If
End Sub
End Class
I am going about this the write way? how will i be able to order the details by item number and manufacturer number?