CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2012
    Posts
    3

    How to insert data from dataset to ms access table using vb.net

    i have the result of the query in a dataset. now i need to insert the data in dataset to an existing table in ms access.

    How to do this., kindly give me the solution with code.,


    Thanks in Advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to insert data from dataset to ms access table using vb.net

    Show your code for the query, for starters....
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Dec 2012
    Posts
    3

    Re: How to insert data from dataset to ms access table using vb.net

    the following code obtains the cartesian product from "cname_4_car_pro" and "stock" table and fills the result in dataset "ds".the dataset contains around 230 rows.

    Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT cname_4_car_pro.cname AS cname, stock.sno AS sno FROM cname_4_car_pro, stock", con)
    Dim ds As DataSet = New DataSet
    da.Fill(ds, "car_pro_temp")

    i dont know how to insert the data in dataset to the table named car_pro_temp in the ms access database.
    i need the code to insert the data from "ds" to "car_pro_temp" using vb.net.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to insert data from dataset to ms access table using vb.net

    INSERT INTO might do it, if the data is perfectly formatted, without errors. I'd save a table then insert it when it's right.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Dec 2012
    Posts
    3

    Re: How to insert data from dataset to ms access table using vb.net

    Can u plz give me the sample "code" for inserting all the data from dataset to DBtable.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to insert data from dataset to ms access table using vb.net

    Code:
    INSERT INTO table_name (column1, column2, column3,...)
    VALUES (value1, value2, value3,...)
    http://www.w3schools.com/sql/sql_insert.asp
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured