Несоответствие данных в выражении критериев
Imports System.Data.OleDb Public Class SongEntry Dim Provider As String Dim dataFile As String Dim connString As String Dim myConnection As OleDbConnection = New OleDbConnection Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() End Sub Private Sub SongEntry_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click Provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" dataFile = "C:\Users\User\Desktop\Song.accdb" connString = Provider & dataFile myConnection.ConnectionString = connString myConnection.Open() Dim str As String str = "Insert into MAS_SONGS([SM_CODE],[SM_EDESC],[SM_TDESC],[SM_SONGL1],[SM_SONGL2]) values (?,?,?,?,?)" Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection) cmd.Parameters.AddWithValue("SM_CODE", TextBox3.Text) cmd.Parameters.AddWithValue("SM_EDESC", TextBox1.Text) cmd.Parameters.AddWithValue("SM_TDESC", TextBox2.Text) cmd.Parameters.AddWithValue("SM_SONGL1", TextBox4.Text) cmd.Parameters.AddWithValue("SM_SONGL2", TextBox5.Text) Try cmd.ExecuteNonQuery() cmd.Dispose() myConnection.Close() Me.Hide() TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() Catch ex As Exception MsgBox(ex.Message) End Try End Sub End Class
Что я уже пробовал:
Hi, i have made data Insert from Vb.Net to Ms access database but when click save button it says "Data Mismatch in criteria expression" Note : SM_CODE is my primary key