heres my code
I know Manual_Ordeing is spelled wrong
Public Class Manual_Ordeing
Public Sub DisplayNames()
Dim connection As System.Data.OleDb.OleDbConnection
Dim datareader As System.Data.OleDb.OleDbDataReader
Dim command As System.Data.OleDb.OleDbCommand
Dim ConnectionString As String
Dim SQLString As String
Dim outputString As String
ConnectionString = “Provider=Microsoft.ACE.OLEDB.12.0;Data ”
ConnectionString += “Source=” & Application.StartupPath & “\User.accdb”
connection = New System.Data.OleDb.OleDbConnection(Connec…
Me.Text = Application.StartupPath
SQLString = “SELECT EquipmentTypeID,Description,Brand,Catego… Catalogue Code,Rental Cost per Day,Quantity of items,Quantity On Hire FROM ManualOrder ”
SQLString += “Order by Description ”
Try
connection.Open()
If ConnectionState.Open.ToString = “Open” Then
command = New System.Data.OleDb.OleDbCommand(SQLString… connection)
datareader = Command.ExecuteReader()
If datareader.HasRows Then
OutputListBox.Items.Clear()
While datareader.Read
If Not IsDBNull(datareader.Item(“Description”)) Then
outputString = datareader.Item(“EquipmentTypeID”).ToStr… & ” ”
outputString += datareader.Item(“Description”).ToString
‘outputString = outputString.PadRight(22)
outputString += datareader.Item(“Brand”).ToString.Substr… 10)
OutputListBox.Items.Add(outputString)
End If
End While
End If
datareader.Close()
End If
Catch
MessageBox.Show(“Error accessing database”)
End Try
connection.Close()
OutputListBox.Items.Add(” “)
OutputlistBox.Items.Add(“Count: & OutputListBox.Items.Count -1”)
End Sub
Private Sub ReadListButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadListButton.Click
DisplayNames()
End Sub
End Class
Thing is its just telling me i cant access the god damn database when the database is in the correct folder and I have the path to find the god damn database its wreckin my head
thanks
Leave a Reply