What is the quickest way to get an xml based dataset to add entries to SQL Server? - XML SOAP

This is a discussion on What is the quickest way to get an xml based dataset to add entries to SQL Server? - XML SOAP ; Because there is no 'datareader' involved, what is the most efficient way to get an XML based dataset to be added to an SQL server dataset? I would hate to have to create a new SQL connection and iterate through ...

+ Reply to Thread
Results 1 to 4 of 4

What is the quickest way to get an xml based dataset to add entries to SQL Server?

  1. Default What is the quickest way to get an xml based dataset to add entries to SQL Server?

    Because there is no 'datareader' involved, what is the most efficient
    way to get an XML based dataset to be added to an SQL server dataset? I
    would hate to have to create a new SQL connection and iterate through
    making "executenonquery" for each row in the dataset. That seems
    horribly in-efficient. I know of no other way to get an xml based
    dataset to push data to the database though. Any pointers?

    Thanks for any pointers,
    Peter Robbins
    Freelance Programmer C#/PHP


  2. Default Re: What is the quickest way to get an xml based dataset to add entries to SQL Server?

    "MurdockSE" <murdock@nc.rr.com> wrote in message
    news:1153922058.675709.165630@h48g2000cwc.googlegroups.com...
    > Because there is no 'datareader' involved, what is the most efficient
    > way to get an XML based dataset to be added to an SQL server dataset? I
    > would hate to have to create a new SQL connection and iterate through
    > making "executenonquery" for each row in the dataset. That seems
    > horribly in-efficient. I know of no other way to get an xml based
    > dataset to push data to the database though. Any pointers?


    Use a DataAdapter and do an Update. Just make sure all the rows youi want
    added are marked as being in Add state.

    John



  3. Default Re: What is the quickest way to get an xml based dataset to add entries to SQL Server?

    Excuse my ADO.NET naivite (newbie alert*) but how do I iterate the
    existing ds and set all of the rows to ADD?

    For example:

    DataSet ds = new DataSet("MyRecords");
    ds.ReadXml(xmlfilename);

    And the seperate SQL creations would be similar to this:

    using System.Data.SqlClient;
    using System.Data;

    string strDBConnection = "server=(local);database=DatabaseName;user
    id=UserName;password=Pwd;connection reset=false;connection
    lifetime=5;Trusted_Connection=Yes;"
    SqlConnection dbConnection;
    dbConnection = new SqlConnection(strDBConnection);

    string strSelectSql = "Select * from
    [DatabaseName].[OwnerName].[TableName] order by FieldName";

    //Open the connection
    dbConnection.Open();

    //Create a command
    SqlCommand selectSqlCommand = new
    SqlCommand(strSelectSql,dbConnection);
    SqlDataAdapter sqlData = new SqlDataAdapter(selectSqlCommand);
    DataSet dsSelectData = new DataSet();
    sqlData.Fill(dsSelectData);

    How do I get the ds into the sqlData adapter set to ADD each row?


    Peter Robbins


  4. Default Re: What is the quickest way to get an xml based dataset to add entries to SQL Server?

    I got the answer/s I was looking for here:

    http://groups.google.com/group/micro...9226fef?hl=en&

    Thanks again. You basically stated the same thing. My naive self just
    needed a little extra push on the particulars. Thanks.

    Peter Robbins


+ Reply to Thread

Similar Threads

  1. Calculated columns based on date in typed Dataset
    By Application Development in forum CSharp
    Replies: 1
    Last Post: 09-02-2007, 12:40 PM
  2. Server does not try 2nd or other MX Entries
    By Application Development in forum Microsoft Exchange
    Replies: 0
    Last Post: 07-24-2006, 09:32 AM
  3. Index Server and the USN entries
    By Application Development in forum Inetserver
    Replies: 1
    Last Post: 04-30-2004, 09:55 AM
  4. Having common calendar entries on server..
    By Application Development in forum Microsoft Exchange
    Replies: 0
    Last Post: 12-05-2003, 07:56 AM
  5. Delete email based on addressbook entries?
    By Application Development in forum Pegasus
    Replies: 3
    Last Post: 09-28-2003, 12:30 PM