this is the code...
I am trying to update a element from login table but it not showing any error massage
or any thing execution is error free but finally whenever i check the database its not
updated.. i'm using access2007 database with vb 2008..
PLEASE Help me..
dbprovider = "Provider=Microsoft.ACE.OLEDB.12.0;"
dbsource = "Data Source=|DataDirectory|\Ex_m.accdb;" & "Persist Security Info=True;" & "Jet OLEDB:Database Password=123456"
con.ConnectionString = dbprovider & dbsource
Dim ds As New DataSet
con.Open()
sql = "select * from System"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Ex_m")
If ds.Tables("Ex_m").Rows(0).Item(3) = False Then
Dim pass1, pass2 As String
con.Close()
pass1 = InputBox("Please Enter ADMIN Password")
pass2 = InputBox("Please Re-enter ADMIN Password")
If pass1 = pass2 And pass1 <> "" Then
con.Open()
Dim daa As OleDb.OleDbDataAdapter
Dim dss As New DataSet
daa = New OleDb.OleDbDataAdapter("select * from Login", con)
Dim cb As New OleDb.OleDbCommandBuilder(daa)
Dim i As Integer
Dim di As DataTable = ds.Tables("Login")
daa.Fill(dss, "Ex_m")
dss.Tables("Ex_m").Rows(0).Item(2) = pass1
Try
i = daa.Update(dss, "Ex_m")
MsgBox("Records Updated= " & i & " , " & dss.Tables("Ex_m").Rows(0).Item(1).ToString() & " , " & dss.Tables("Ex_m").Rows(0).Item(2).ToString())
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
con.Open()
da = New OleDb.OleDbDataAdapter("select * from System", con)
Dim cb2 As New OleDb.OleDbCommandBuilder(da)
da.Fill(ds, "Ex_m")
'ds.Tables("Ex_m").Rows(0).Item(3) = True
da.Update(ds, "Ex_m")
con.Close()
Else
con.Close()
MsgBox("Please restart the application and Enter valid Admin Password")
End
End If
End If
con.Close()