Hi, I am using visual studio 2008. I have a winforms app that takes data from an xml doc. I store the data in a ms sql database that I have created via a stored procedure. When Irun the app the data from the xml doc is captured and put in the database, but I can only see old data, the data that is captured during the current session can not be seen unless I close the app down and restart it. I have tried the following, and every variation I can think of to allow me to see the new data but to no avail. Please can anyone help. Thanks for all and any help.
'this code opens the connection and inserts new data into the dbase _con = New SqlConnection() _connectionString = My.Resources.LogOnStrings.DataSourceSQLEXPRESSAttachDbFilenameCBGame _con.ConnectionString = _connectionString _con.Open() Dim cmd As SqlCommand cmd = New SqlCommand() With cmd .Connection = _con .CommandType = CommandType.StoredProcedure .CommandText = ("InsertUser") .Parameters.Add("@gnumber", SqlDbType.VarChar).Value = gamenumber .ExecuteNonQuery() End With _con.Close() 'and then this is the code I have used in an attempt to see the newly acquired data Try Me.Validate() Me.DBGameTableBindingSource.EndEdit() Me.DBGameTableTableAdapter.Update(Me.DBGameDataSet.DBGameTable) DBGameDataSet.GetChanges() Me.DBGameTableTableAdapter.Fill(DBGameDataSet.DBGameTable) MsgBox("Update successful") Me.DBGameDataSet.AcceptChanges() Catch ex As Exception MsgBox("Update failed") End Try
Edited 3 Years Ago by Dani: Formatting fixed