首页 > 解决方案 > 下一个按钮显示此错误 {"从字符串 ""Error"" 到类型 'Integer' 的转换无效。"}

问题描述

Imports System.Data
Imports System.Data.OleDb
Module Module1
    Public Con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Zmare\Desktop\Database\Unique Center Quetta\Unique Center Quetta\bin\Debug\DB.mdb")

    Public cmd As OleDbCommand
    Public dad As OleDbDataAdapter
    Public dst As New DataSet
    Public currentrow

End Module
 Private Sub showdata(ByVal currentrow)

        Try

            txtID.Text = dst.Tables("Invoice").Rows(currentrow)("ID")
            txtInvoiceNo.Text = dst.Tables("Invoice").Rows(currentrow)("Invoiceno")
            txtidate.Text = dst.Tables("Invoice").Rows(currentrow)("Idate")
            txtdistributor.Text = dst.Tables("Invoice").Rows(currentrow)("Distributor")
            txtaddress.Text = dst.Tables("Invoice").Rows(currentrow)("Address")
            txtstregno.Text = dst.Tables("Invoice").Rows(currentrow)("Stregno")
            txtcname.Text = dst.Tables("Invoice").Rows(currentrow)("Cname")
            txtddate.Text = dst.Tables("Invoice").Rows(currentrow)("Ddate")
            txtcaddress.Text = dst.Tables("Invoice").Rows(currentrow)("caddress")
        Catch ex As Exception
            MsgBox(ex.Message, "Error")
        End Try
    End Sub

  Private Sub btnnext_Click(sender As Object, e As EventArgs) Handles btnnext.Click
        If currentrow = dst.Tables("Invoice").Rows.Count - 1 Then
            MsgBox("You are on Last Record", MsgBoxStyle.Exclamation)
        Else
            CurrentRow += 1
            ShowData(CurrentRow)
        End If

    End Sub

标签: vb.net

解决方案


推荐阅读