|
Quote:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myDataReader As OleDb.OleDbDataReader = Nothing
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = a:\DataReaderAssign.mdb;Persist Security Info=False"
Dim myConnection As New OleDb.OleDbConnection(connectionString)
Dim myCommand As New OleDb.OleDbCommand{"SELECT * FROM DataReaderAssign", myConnection)
'Add header information to the listbox
lstData.Items.Add("ProdID" & vbTab & "Name" & vbTab & "NumberInStock" & vbTab & "Price" & vbTab & "Total Value")
Try
'Open(Connection)
myConnection.Open()
myDataReader = myCommand.ExecuteReader
'Declare variables to capture the quantity and price of each item
Dim intQuant As Integer
Dim sngPrice As Single
'Read data into the variable
While myDataReader.Read()
sngPrice = Val(myDataReader("Price"))
intQuant = Val(myDataReader("NumberInStock"))
'Populate the listbox with field data and the calculated value for each inventory item
lstData.Items.Add(myDataReader("ProdID") & vbTab & myDataReader("Name") & vbTab & myDataReader("NumberInStock") & vbTab & Format(myDataReader("Price"), "c") & vbTab & Format(sngPrice * intQuant, "c"))
End While
Finally
myConnection.Close()
End Try
End Sub
|
END OF STATEMENT EXPECTED ON DECLARATION OF MYCOMMAND. IT WONT TAKE STUPID SQL PROCEDURE.
I'll probably just hand it in like this.
How ya doing, buddy?