populate dataset

Posted on 2005-04-20
Last Modified: 2010-04-23

 I want to populate this data to the dataset

        Dim FileName As String
        Dim FileAlias As String
        Dim FileUrl As String
        Dim SysDate As String

        FileName = Session("FileName").ToString
        FileAlias = Session("FileAlias").ToString
        FileUrl = Session("FileUrl").ToString
        SysDate = Session("SysDate").ToString

What I need is create columns in the data set named filename, filealias, fileurl, sysdate
and everytime there is data in these variables I need to fill it in the dataset and then populate the datagrid with this data

Question by:rahulnimje
    LVL 23

    Expert Comment

    Public NotInheritable Class DataSetCollectionBase
          Private Sub New
          End Sub
          Private Shared sessionTable As DataTable
          Public Shared Function NewSessionTable() As DataTable
                If sessionTable Is Nothing Then
                      sessionTable = New DataTable("Session")
                      With sessionTable.Columns
                      End With
                End If
                Return sessionTable.Clone()
          End Function

    End Class
    LVL 23

    Accepted Solution

    Dim ds As New DataSet()
    Dim table As DataTable = DataSetCollectionBase.NewSessionTable()
    'first way
    table.Rows.Add(New Object [] { Session("FileName").ToString, Session("FileAlias").ToString, Session("FileUrl").ToString, Session("SysDate").ToString})
    'second way
    Dim row As DataRow = table.NewRow()
    row("FileName") = "yadda"
    row("FileAlias") = "x"
    row("FileUrl") = "gsgs"
    row("SysDate") = "dada"

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    754 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

    17 Experts available now in Live!

    Get 1:1 Help Now