Свойство connectiionstring не было очищено. Vb.net 2013
Public Class Form1 Private Sub Addnew_Click(sender As Object, e As EventArgs) Handles Addnew.Click Try cm = New OleDb.OleDbCommand With cm .Connection = cn .CommandType = CommandType.Text .CommandText = "INSERT INTO members (Date,Bowen,Nursing,Bowen1,Nursing1,Total Bowen,Total Nursing) " & _ "VALUES (@Date,@Bowen,@Nursing,@Bowen1,@Nursing1,@Total Bowen,@Total Nursing); " .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Date", System.Data.OleDb.OleDbType.VarChar, 255, Me.DateDateTimePicker.Text)) .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Bowen", System.Data.OleDb.OleDbType.VarChar, 255, Me.BowenTextBox.Text)) .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Nursing", System.Data.OleDb.OleDbType.VarChar, 255, Me.NursingTextBox.Text)) .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Bowen1", System.Data.OleDb.OleDbType.VarChar, 255, Me.Bowen1TextBox.Text)) .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Nursing1", System.Data.OleDb.OleDbType.VarChar, 255, Me.Nursing1TextBox.Text)) .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Total Bowen", System.Data.OleDb.OleDbType.VarChar, 255, Me.Total_BowenTextBox.Text)) .Parameters.Add(New System.Data.OleDb.OleDbParameter("@Total Nursing", System.Data.OleDb.OleDbType.VarChar, 255, Me.Total_NursingTextBox.Text)) ' RUN THE COMMAND cm.Parameters("@Date").Value = Me.DateDateTimePicker.Text cm.Parameters("@Bowen").Value = Me.BowenTextBox.Text cm.Parameters("@Nursing").Value = Me.NursingTextBox.Text cm.Parameters("@Bowen1").Value = Me.Bowen1TextBox.Text cm.Parameters("@Nursing1").Value = Me.Nursing1TextBox.Text cm.Parameters("@Total Bowen").Value = Me.Total_BowenTextBox.Text cm.Parameters("@Total Nursing").Value = Me.Total_NursingTextBox.Text cn.Open() cm.ExecuteNonQuery() cn.Close() MsgBox("Record saved.", MsgBoxStyle.Information) Me.DateDateTimePicker.Text = "" Me.BowenTextBox.Text = "" Me.NursingTextBox.Text = "" Me.Bowen1TextBox.Text = "" Me.Nursing1TextBox.Text = "" Me.Total_BowenTextBox.Text = "" Me.Total_NursingTextBox.Text = "" Exit Sub End With Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) End Try End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub BowenLabel_Click(sender As Object, e As EventArgs) End Sub Private Sub DateLabel_Click(sender As Object, e As EventArgs) End Sub Private Sub DateDateTimePicker_ValueChanged(sender As Object, e As EventArgs) Handles DateDateTimePicker.ValueChanged End Sub Private Sub IDTextBox_TextChanged(sender As Object, e As EventArgs) Handles IDTextBox.TextChanged End Sub Private Sub IDLabel_Click(sender As Object, e As EventArgs) End Sub Private Sub FlowLayoutPanel1_Paint(sender As Object, e As PaintEventArgs) End Sub End Class
Что я уже пробовал:
я пробовал так много способов исправить это