error i'm getting : Object reference not set to an instance of an object.
VB.NET:
Public Class CreateInvoice
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub CreateInvoice_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\mySystemRemake\SystemDb.mdb"
con.ConnectionString = dbProvider & dbSource
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
MsgBox("Do you wish to add this Invoice?", MsgBoxStyle.YesNo, "")
If MsgBoxResult.Yes Then
con.Open()
sql = "SELECT * FROM SalesTbl"
da = New OleDb.OleDbDataAdapter(sql, con)
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim newentry As DataRow
newentry = ds.Tables("SalesTbl").NewRow()
newentry.Item("SaleDate") = MaskedTextBox1.Text
newentry.Item("Subtotal") = TextBox1.Text
newentry.Item("Discounts") = TextBox2.Text
newentry.Item("Total") = TextBox3.Text
newentry.Item("Details") = RichTextBox1.Text
newentry.Item("SoldTo") = ComboBox1.Text
ds.Tables("SalesTbl").Rows.Add(newentry)
da.Update(ds, "SalesTbl")
con.Close()
MsgBox("Invoice succesfully added to Database")
Else
Me.Close()
End If
End Sub