Inserting Records in database using Dataset


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Inserting Records in database using Dataset

  1. #1
    Join Date
    Jun 2004
    Location
    Pakistan
    Posts
    292

    Inserting Records in database using Dataset

    Hi, my ADO.NET skills are very weak so I dont even know if it is possible or no. Basically I know how to get the records from the database using a dataadapter, edit it, and then update it. What I am trying to do here is that I have a two datatables that are within a dataset. Let's just say that this dataset was received as a parameter, is it possible to update two tables in the database with the all the records in the tables from that dataset which is being passed as a parameter.
    Something similar to this if my wording doesn't make any sense:
    Code:
    Private Sub_Insert(DS as DataSet)
       dim dt0 as DataTable = ds.Tables(0)
       dim dt1 as DataTable = ds.Tables(1)
    
    'update Database
        'Insert records in dbo.table0
    
        'Insert records in dbo.table1
    
    end sub
    Edits: sorry just to add to it, this is for SQL Server as backend.
    new to programming but getting ther

  2. #2
    Join Date
    May 2006
    Posts
    64
    The SQLDataReader object is used to provide with a forward-only, read-only set of data(records). The forward-only means that we can loop through the records in only one direction. The read-only means the data can not be updated through the SQLDataReader object. Now we would like to complete the example to get all data from the Customers table

    Dim conn as SQLConnection = New SQLConnection("server=yourSERVER;Database=Northwind;uid=USERID;pwd=PASSWORD;")

    Dim sSQL as String = "SELECT * FROM Customers" (SQL Statement)
    Dim cmd as SQLCommand = New SQLCommand(sSQL, conn)

    conn.Open()

    Dim dr as SQLDataReader = cmd.ExecuteReader()

    We can use this set of data to display in DataGrid

    DataGrid1.DataSource = dr
    DataGrid1.DataBind()

    conn.Close()

    =========================

    Find an example at http://www.programmingknowledge.com/


    =======

  3. #3
    Join Date
    Jun 2004
    Location
    Pakistan
    Posts
    292
    What you just said doesn't make any sense what so ever regarding what I asked for.
    new to programming but getting ther

Similar Threads

  1. Replies: 1
    Last Post: 09-19-2002, 08:28 AM
  2. Replies: 1
    Last Post: 06-24-2002, 04:26 AM
  3. Replies: 2
    Last Post: 03-15-2002, 02:08 PM
  4. inserting select records into another table
    By Melanie Peterson in forum Database
    Replies: 0
    Last Post: 12-05-2000, 03:16 PM
  5. Multiple Database Architecture
    By mholt28 in forum VB Classic
    Replies: 1
    Last Post: 06-05-2000, 11:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center