Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim baglan As New OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0; Data Source=db.accdb")
Dim tur, tutar, sql As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sql = "insert into gelir (tur,tutar) VALUES ('" & tur & "', '" & tutar & "')"
Dim komut As New OleDbCommand
komut.Connection = baglan
komut.CommandText = sql
baglan.Open()
komut.ExecuteNonQuery()
MessageBox.Show("Geliriniz Kaydedildi")
baglan.Close()
End Sub
End Class
我认为问题出在sql string中。