You must Sign In to post a response.
  • Category: .NET

    How to create Dynamic Dataset in vb.net

    Hi friends,
    I have one doubt regarding Generating dynamic dataset executing sp in vb.net. Is it possible to create dynamic Dataset. if yes means how can we create and add the values from sp. becoz, i hav dynamic sp for running. based on sp running i have to create dataset. But Each dataset should contain each sp's output. then only it will help me do another process. Kindly guide me do this.
  • #761224
    Hello Karunanidhi,

    DataSet is collection of many DataTables. A DataSet is conceptually a set of DataTables and other information about those tables.

    Refer the below code :

    Try
    Dim con As New SqlConnection("Your connection string")
    Dim ds As New DataSet()
    ds.Clear()
    con.Open()
    Dim da As New SqlDataAdapter("SELECT Distinct(Item_Name) FROM ItemMaster", con)
    da.Fill(ds)
    ComboBoxItemName.DataSource = ds.Tables(0)
    ComboBoxItemName.ValueMember = "Item_Name"
    ComboBoxItemName.DisplayMember = "Item_Name"
    ComboBoxItemName.SelectedIndex = -1
    Catch ex As Exception
    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
    Finally
    con.Close()
    End Try

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #761479
    Hello,

    Try this one also, by using this code we can add a dynamic dataset.


    Dim ds As New DataSet()
    Dim table As New DataTable("myTable")
    table.Columns.Add("column1", GetType(String))
    table.Columns.Add("column2", GetType(String))
    table.Rows.Add("a1", "b1")
    table.Rows.Add("a2", "b2")
    ds.Tables.Add(table)


    Still if you face problem then let me know.

    Regards,
    Dhiraj C. Solanki


Sign In to post your comments