Yorkshire Divers

Deep Blue Technical
Go Back   YD Scuba Diving Forums > Non-Diving Related Forums > Technology
User Name
Password

Welcome to the YD Scuba forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

Technology: Discuss Copying Database Tables Across Servers via C# in the Non-Diving Related Forums forums: OK, so this is easy in SQL, but not so easy in C#. The idea is to take a table ...

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20-09-06, 11:57 AM
MartinS's Avatar
Senior Member
 

Join Date: Jul 2002
Location: Redhill, Surrey
Posts: 1,552
MartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the sea
Copying Database Tables Across Servers via C#

OK, so this is easy in SQL, but not so easy in C#.
The idea is to take a table on Server1 and make a copy of it on Server2, and having tried it using DTS, I'm still not sure it's doing it right.
Does anyone know of a surefire way to do this in C# .Net, and if so, some sample code to get me started?
Regards
Martin
__________________
Never test the depth of the water with both feet!
69 Divers SAC
Yorkshire Divers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 20-09-06, 12:53 PM
RonProwse's Avatar
why does it always do that......
 

Join Date: Feb 2006
Location: Chatham
Posts: 537
RonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold water
Martin its best using DTS to move the table otherwise you have a link between source and destination to do this with SQL

R
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 20-09-06, 12:58 PM
MartinS's Avatar
Senior Member
 

Join Date: Jul 2002
Location: Redhill, Surrey
Posts: 1,552
MartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the sea
Hi Ron
It's being done via DTS, which is being 'run' by a C# web application but the table is not arriving at the other end as expected, even though it seems to complete the task.
Hunting about, it seems this is not an unusual result to using DTS via C#, so was just wondering if anyone here had done this and knew a way to complete the task successfully.
Thanks for the advice (have a green, if I am able)
Martin
__________________
Never test the depth of the water with both feet!
69 Divers SAC
Yorkshire Divers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 20-09-06, 12:59 PM
Conor's Avatar
Ginger, Irish, sometimes stroppy
 

Join Date: Jun 2003
Location: Royston (Herts)
Posts: 5,995
Conor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold waterConor swims in cold water
I've had enough of this pseudo racist biggoted s&%t!!!

oops, wrong thread
__________________
“Did I leave the gas on? No! No, I'm a f***in' squirrel!”

Mr E Izzard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 20-09-06, 01:03 PM
MartinS's Avatar
Senior Member
 

Join Date: Jul 2002
Location: Redhill, Surrey
Posts: 1,552
MartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the sea
Quote:
Originally Posted by Conor
I've had enough of this pseudo racist biggoted s&%t!!!

oops, wrong thread
Am still chuckling as I leave you green
__________________
Never test the depth of the water with both feet!
69 Divers SAC
Yorkshire Divers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 21-09-06, 07:48 AM
RonProwse's Avatar
why does it always do that......
 

Join Date: Feb 2006
Location: Chatham
Posts: 537
RonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold water
Martin soory for the late ness in replying but its best if the two servers are linked and you use the sql agent to fire the job at a specific time during the day. Im not to up on firing DTS packages from with C#.

You say that its not arriving as you expect it, if you expand on that i might be able to help.


you could call the dts job from a stored proc that way your code can just fire that off, di you have a way of working out if the job failed etc
R
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 21-09-06, 09:28 AM
MartinS's Avatar
Senior Member
 

Join Date: Jul 2002
Location: Redhill, Surrey
Posts: 1,552
MartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the sea
Ron
Looks like i may have found a solution - .NET 2 has a new class called SQLBulkCopy which allows the copy of tables from one server to another in about five lines of code - once I have organised the installation of the .NET 2 framework, I will be having a play and seeing how to integrate the new .NET 2 classes into my project.
Thanks anyway for yur help - I may be back if it all goes to pot!
Martin
__________________
Never test the depth of the water with both feet!
69 Divers SAC
Yorkshire Divers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 21-09-06, 09:57 AM
RonProwse's Avatar
why does it always do that......
 

Join Date: Feb 2006
Location: Chatham
Posts: 537
RonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold waterRonProwse swims in cold water
Not too sure but you may have to upgrade to VS 2005, no i think its ok.

but to get the best out of .Net 2.0 you should try out sql server 2005.

Ron

Last edited by RonProwse : 21-09-06 at 10:08 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 21-09-06, 10:46 AM
MartinS's Avatar
Senior Member
 

Join Date: Jul 2002
Location: Redhill, Surrey
Posts: 1,552
MartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the seaMartinS paddles in the sea
Ron
As a development team we are looking into the best edition of VS2005 for us, and the implementation of SQL 2005 is also iminent - it's all down to the managers actually giving the OK to go ahead and do it.
Thanks again
Martin
__________________
Never test the depth of the water with both feet!
69 Divers SAC
Yorkshire Divers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 21-09-06, 02:14 PM
Garf's Avatar
Chimp 2
 

Join Date: Aug 2003
Location: West Sussex
Posts: 6,156
Garf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gillsGarf was born with gills
bcp is a hell of a lot quicker than DTS anyway, but it does have its own limitations.

Personally, I'd have just written a SELECT/INSERT into a stored procedure and then fired it from a SQL agent job or called the stored procedure from your code.
__________________
Garf
Postatem obscuri lateris nescitis.
www.teamfoxturd.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Sponsored Links

Yorkshire Divers - RSS Feed
All times are GMT +1. The time now is 11:28 AM.
Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Trademark and all rights reserved : © YD.com Ltd (2006)
YD.com Ltd (Registered in England - 05886696)
Other sites : Golf Clubs | New Premiership Football Kits | MP3 Portable Players | MP3 Players For Sale | Replica Football Kits | Cheap Football Boots

Forums Directory