Results 1 to 1 of 1

Thread: Runtime Error

  1. #1
    Join Date
    Jul 2006
    Posts
    157

    Unanswered: Runtime Error

    I am not understanding this error. Can any one please help me out? Thanks

    Imports System.Data.OleDb
    Public Class Form1
    Public connection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\mkhan\Desktop\generalledger.accdb"
    Public conn As New OleDbConnection

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    conn.ConnectionString = connection
    If conn.State = ConnectionState.Closed Then
    conn.Open()
    MsgBox("Open")
    Else
    MsgBox("Closed")

    End If

    End Sub

    Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click
    Dim dsNewRow As DataRow
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim cb As New OleDb.OleDbCommandBuilder(da)
    dsNewRow = ds.Tables("Voucher").NewRow()
    dsNewRow.Item("VoucherName") = TxtVoucher.Text
    dsNewRow.Item("Account_Code") = TxtAccount.Text
    dsNewRow.Item("Amount") = TxtAmount.Text
    ds.Tables("Voucher").Rows.Add(dsNewRow)
    da.Update(ds, "Voucher")
    Me.Close()
    End Sub
    End Class
    Attached Thumbnails Attached Thumbnails error.png  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •