Link to home
Start Free TrialLog in
Avatar of ljhodgett
ljhodgett

asked on

Create dataset programatically in vb.net 2005

Hi,

I'm trying to find out how to create a dataset and table programatically.

Basically I need a table that will store textbox1.text in column 1 and textbox2.text in column 2

How do I do this please?

Many thanks
Lee
Avatar of ToFro
ToFro
Flag of Finland image

Try this:

        Dim ds As New DataSet
        Dim dt As New DataTable("table1")

        dt.Columns.Add("Column1", GetType(String))
        dt.Columns.Add("Column2", GetType(String))

        Dim row As DataRow = dt.NewRow
        row("Column1") = TextBox1.Text
        row("Column2") = TextBox2.Text
        dt.Rows.Add(row)
        ds.Tables.Add(dt)
ASKER CERTIFIED SOLUTION
Avatar of ToFro
ToFro
Flag of Finland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial