i am adding records to the database and when i click on save button i save the records and at the end load loadgriddata(Nothing) to refresh the grid but nothing happens. if I create another button and loadgriddata(Nothing) the grid show the new record. its like the loadgriddate(Nothing) cannot show new record added in the same procedure.
Protected Sub Button7__Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim sss As Integer
Dim texto As String
Dim dba As New ADODB.Connection
Dim rst As New ADODB.Recordset
texto = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~\App_Data\eeggimdb.mdb") & ";"
dba.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & texto & ";Jet OLEDB:Database Password=cacaseca"
dba.Open()
rst.Open("SELECT ciais.* FROM ciais where (((ciais.ci) = " & TextBox17.Text & ") and ((ciais.numeroexterno) = " & TextBox5.Text & "));", dba, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
If rst.RecordCount = 0 Then
If TextBox25.Text = "" Then GoTo fuera
rst.AddNew()
rst.Fields("def").Value = Val(TextBox25.Text)
rst.Update()
'rst.Close()
TextBox25.Text = ""
griddata.Text = "Select ciais.def FROM ciais;"
LoadGridData(Nothing)
End If
fuera:
End Sub
and if i add this button i can see the new record when i press it manually after the first one
Protected Sub Button17_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button17.Click
LoadGridData(Nothing)
End Sub
I am usind the loadgriddata samble from grid features