1

OLEDB以下のコードでは、接続で使用される「削除」ボタンでした。私のデータベース テーブル名はtblinformationです。

ところで、エラーが表示されます:

Data type mismatch in criteria expression. `-Microsoft JET DATABASE ENGINE`, and it was in a form of msgbox..



Imports System.Data.OleDb
Imports System.String
Public Class frmbookinfo
Dim cnn As New OleDb.OleDbConnection


Dim Str As String
    If CheckId() = False Then
        MsgBox("Id : Integer Value Required!!!")
        Exit Sub
    End If
    Try
        Str = "delete from tblinformation where bcode="
        Str += txtbookcode.Text.Trim
        Con.Open()
        Cmd = New OleDbCommand(Str, Con)
        Cmd.ExecuteNonQuery()
        Dst.clear()
        Dad = New OleDbDataAdapter("SELECT * FROM tblinformation ORDER BY bcode", Con)
        Dad.Fill(Dst, "tblinformation")
        MsgBox("Record deleted successfully...")
        If CurrentRow > 0 Then
            CurrentRow -= 1
            ShowData(CurrentRow)
        End If
        Con.Close()
    Catch ex As Exception
        MessageBox.Show("Could Not delete Record!!!")
        MsgBox(ex.Message & " -  " & ex.Source)
        Con.Close()
    End Try
4

1 に答える 1