Solved refresh dataset

Posted on 2012-08-17
Last Modified: 2012-08-22
Hi Experts,

I have the following code to setup to load a datagrid with data from a table in a dataset. In a seperate procedure I need to refresh the data in the table in the dataset (the table in the back end database will have been modified by this time). I just cant figure out how to do it?...


Public Sub LoadLinesGrid()

Dim LinesConnString As String
Dim LinesConnConect As SqlConnection
Dim LinesConnAdapter As New SqlDataAdapter
Dim LinesSelectSql As String
Dim LinesSQDataset As New DataSet()
Dim MyIndex As Integer

LinesConnString = "Data Source=XXXXX"
LinesConnConect = New SqlConnection(LinesConnString)

LinesSelectSql = "Select * FROM WPFtblSmartQuoteLines where LinesAstuteRef = '" & FlxHeader(MyIndex, 8).Text.ToString & "'"

'Open connect to OMSytem
'Insert SQL Select COMMMAND above
    LinesConnAdapter.SelectCommand = New SqlCommand(LinesSelectSql, LinesConnConect)
'Run SQL Select Query

'Load Dataset with results..

'Set Dateset to load into DbGrdGRNInfo
    FlxLine.ItemsSource = LinesSQDataset.Tables(0).DefaultView

'Clear SqlAdaptor
    LinesSelectSql = Nothing
'Close Connection to OMSystem

Catch ex As Exception
End Try

End Sub
Question by:deanlee17
    LVL 83

    Accepted Solution

    Just execute the LoadLinesGrid sub again? You may have to put


    before that.

    Author Comment

    Because of the way other code is linking in I cannot just re-run LoadLinesGrid. Can I force the dataset to refresh itself, found the code below but no idea how to change it to my needs....

            Dim UpdateAD As New OMSystemDataSetTableAdapters.tblGIQTableAdapter

    LVL 83

    Expert Comment

    Refreshing is reloading so either your call that method or you write duplicate code to reload that dataset. How is other code linking there?

    Author Comment

    Ah ur right, its fine, thanks.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    This article will show, step by step, how to integrate R code into a R Sweave document
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now