I am using Visual Studio 2008 for creating a Winforms app. I have connected a database to it called XStats. There is one table in it called XGames and in that table 2 fields, XIndex
(the primary key field) and GameNumber
. Using the following code I can add records to the database, the data is taken from a text box, but once added I cannot view them unless I shut down the app and restart it.
con.ConnectionString = connectionString
con.Open()
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "INSERT INTO XGames (GameNumber) VALUES ('" + TextBox701.Text + "')"
cmd.ExecuteNonQuery()
con.Close()
The existing records in the database are displayed on the form in detailed view via a binding navigator. How can I make it so that I can view all the records in the database, even those that are added during the current session. As will be obvious, this is my first attempt at creating and using a database with a win forms app, so all and any help is most welcome. Thank you.