[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

populate dataset

Posted on 2005-04-20
2
Medium Priority
?
318 Views
Last Modified: 2010-04-23
Hello,

 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

Thanks,
Rahul
0
Comment
Question by:rahulnimje
  • 2
2 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 13826912
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
                        .Add("FileName",GetType(String))
                        .Add("FileAlias",GetType(String))
                        .Add("FileUrl",GetType(String))
                        .Add("SysDate",GetType(String))
                  End With
            End If
            Return sessionTable.Clone()
      End Function


End Class
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 2000 total points
ID: 13826931
Dim ds As New DataSet()
Dim table As DataTable = DataSetCollectionBase.NewSessionTable()
ds.Tables.Add(table)
'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"
table.Rows.Add(row)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

873 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