I am new to using databases in applications and i have a code to select data from the database. However, the first time the application starts, new data is inserted into the database which is needed after. But, the data does not appear until the whole application is restarted.
I need some help on how i can refresh the database content.
The current code for selecting the data is:
Imports System.Data.SqlServerCe Public Class MSSUI Dim con As SqlCeConnection = New SqlCeConnection(My.Settings.DB1ConnectionString) Dim cmd As SqlCeCommand Dim myDA As New SqlCeDataAdapter Dim myDataSet As New DataSet Private Sub MSSUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cmd = New SqlCeCommand("SELECT * FROM srcdspath", con) If con.State = ConnectionState.Closed Then con.Open() Dim sdr1 As SqlCeDataReader = cmd.ExecuteReader() While sdr1.Read = True srcds21 = (sdr1.Item("path")) extracmds.Text = (sdr1.Item("path")) End While cmd.Dispose() sdr1.Close() End Sub 'other codes doing things End Class
Thank's in advance