Reading from database1 writing to database2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Jones

    Reading from database1 writing to database2

    Ok......... here's my dilemma. I'm filtering rows from a Sql
    Datatable in my server. How can I write those filtered rows onto new
    Datatable in the same server. I'm trying to use c# to accomplish
    this. I'm new at C# guys, bare with me!
  • news.microsoft.com

    #2
    Re: Reading from database1 writing to database2

    I guess ur new to the internet too, new to google, new to msdn.


    "Michael Jones" <epmcj38@yahoo. com> wrote in message
    news:beddf641.0 310271320.3c5ea 73f@posting.goo gle.com...[color=blue]
    > Ok......... here's my dilemma. I'm filtering rows from a Sql
    > Datatable in my server. How can I write those filtered rows onto new
    > Datatable in the same server. I'm trying to use c# to accomplish
    > this. I'm new at C# guys, bare with me![/color]


    Comment

    • Richard K Bethell

      #3
      Re: Reading from database1 writing to database2

      "Michael Jones" <epmcj38@yahoo. com> wrote in message
      news:beddf641.0 310271320.3c5ea 73f@posting.goo gle.com...[color=blue]
      > Ok......... here's my dilemma. I'm filtering rows from a Sql
      > Datatable in my server. How can I write those filtered rows onto new
      > Datatable in the same server. I'm trying to use c# to accomplish
      > this. I'm new at C# guys, bare with me![/color]

      You could probably do this with one single SQL query, but if you have a need
      to do it in C#, your workflow would be like this.


      1. Write a function that takes parameters for each column in the new
      datatable. Inside the function write a SqlCommand that takes these
      parameters and does an insert into the database.
      2. Create an ADO.Net SqlDataAdapter with the SQL query needed to put the
      rows in a datatable, and the connection string
      3. Fill a new DataTable with the SqlDataAdapter you just created
      4. Do a foreach loop on DataRows in the DataTable. For each one, call the
      function you wrote in #1.

      R.


      Comment

      • Michael Jones

        #4
        Re: Reading from database1 writing to database2

        Yes I am.

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Michael Jones

          #5
          Re: Reading from database1 writing to database2


          Thanks Richard........ .......... I already had my DataTable but wasn't
          sure how to send that info back to my database. I'll let you know how
          it turns out.

          M

          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          Working...