Welcome Guest Search | Active Topics | Sign In | Register

when add records to the database and load the grid do not show new record Options
WalterWilliamsCostaRica
Posted: Wednesday, April 15, 2015 10:54:09 AM
Rank: Newbie
Groups: Member

Joined: 3/18/2015
Posts: 3
Code: Visual Basic.NET


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
eo_support
Posted: Wednesday, April 15, 2015 2:53:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You will want to check the Grid's data source. The following two lines populate the Grid:

Code: C#
Grid1.DataSource = your_data_source;
Grid1.DataBind();


If your data source is empty then the Grid will be empty, if your data source has record then the Grid will have data.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.