我试图用访问数据库更新vb.net上的数据,但数据没有更新,没有错误

时间:2016-06-22 14:13:28

标签: vb.net ms-access

我在公共类上声明了sql,cmd和cnt,并且我已经在Module上声明了我的数据库。

Dim sql As String 
Dim cmd As OleDb.OleDbCommand
Dim cnt As Long

   Try

      sql = "UPDATE  [LDF]  SET [Group_Code] = '" & ComboBox1.Text & "',  
                                [Loan_Disb] ='" & TextBox1.Text & "',
                          [No_Of_Instalment] = '" & ComboBox2.Text & "',
                          [Single_Instalment]='" & TextBox2.Text & "',
                          [Loan_Security]='" & TextBox3.Text & "',
                          [Total_Amnt_TR]='" & TextBox4.Text & "', 
                          [Member_Name]='" & TextBox5.Text & "',
                          [Group_Name]='" & TextBox6.Text & "',
                          [Date_Of_Disb]='" & DateTimePicker1.Value & "' 
                          WHERE [Member_Number] = ' & ComboBox3.Text & '"

        cmd = New OleDb.OleDbCommand(sql, Con)
        cnt = cmd.ExecuteNonQuery
        MsgBox("RECORD HAVE SUCCESSFUL UPDATED")
    Catch ex As Exception
        MessageBox.Show(ex.ToString)
    End Try

0 个答案:

没有答案