I am trying to use a datagrid for the first time to display and eventually update and add data from a msAccess database. Here is the code I have so far and at the bottom I have the error message I am getting. If anyone knows why I am getting this based on the code, I could really use the help. I am still new to Vb.Net.
When I go to run it, I get the error:
"An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll " referring to the code "Dacomm.fill(dscomm)" located under the find button. I get this error when I type in the invoice number adn then click FIND. Any ideas on what is going on or what I need to change?
Thanks,
Brent
Code:
Public Class frminvoice
Inherits System.Windows.Forms.Form
Dim CmdInvoice As New OleDb.OleDbCommand
Dim dacomm As New OleDb.OleDbDataAdapter
Dim dscomm As New DataSet
Private Sub frminvoice_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DbConnect.Open()
dacomm.SelectCommand = CmdInvoice
End Sub
Private Sub cmdfind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdfind.Click
With CmdInvoice
.Connection = DbConnect
.CommandType = CommandType.Text
.CommandText = "SELECT InvoiceDate, InvoiceNumber,
CustomerNumber, BrokerID, LineSEQNo, ItemNumber,
ProductLine, QuantityShipped, LastUnitPrice, Total,
COMM, Commissions, Terms, DiscountPercentage FROM
Pending Commissions WHERE InvoiceNumber = " & txtinvnum.Text
End With
dscomm.Clear()
dacomm.Fill(dscomm)
dbgcomm.DataSource = dscomm.Tables(0)
End Sub
"An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll " referring to the code "Dacomm.fill(dscomm)" located under the find button. I get this error when I type in the invoice number adn then click FIND. Any ideas on what is going on or what I need to change?
Thanks,
Brent
Last edited by a moderator: