473,671 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Database Schema

In my C# project..
I have Sql Database with data of 700 MB... I'm redesign tables and
relations and need to retrieve my data in the new tables..

I'm using SqlAdapter to Get old tables in my dataset then use the
GetChildRows(). .. insert new records in the new tables.
Here is the code which convert first 2 tables to 3 new tables:-

####### CODE START ############### ########
private void btn_Start_Click (object sender, System.EventArg s e)

{

this.transActio nStart();

}

private void transActionStar t()

{

progressBar1.Va lue = 0;

adp_Old_E7sea2y a.Fill(dsOld.E7 saeya_List);

adp_Old_Country _list.Fill(dsOl d.E7saeya_Count ry_List);

adp_Old_Mo2shra t.Fill(dsOld.E7 saeyaDetails);

adp_Old_Mo2_Det ails.Fill(dsOld .E7saeya_Main);

progressBar1.Ma ximum = dsOld.E7saeya_L ist.Rows.Count;

this.setAhsa2ya t();

}

private void setAhsa2yat()

{

ni_Ahsa2yat = new NewIndex();

foreach (DataSetOld.E7s aeya_ListRow row in dsOld.E7saeya_L ist)

{

int ah_id = ni_Ahsa2yat.Get Index("Ahsa2yat ");

int succ = this.sqlCommand Param(Ins_Ahsa2 ya, ah_id, row.E7saeya_Nam e);

if (succ == 1)

{

ni_Ahsa2yat.Upd ateIndex("Ahsa2 yat");

DataSetOld.E7sa eya_Country_Lis tRow[] rows=
(DataSetOld.E7s aeya_Country_Li stRow[])row.GetChildRo ws("Rel_AH_Coun try");

this.setCountri es(rows, row.E7saeya_ID, ah_id);

}
System.Threadin g.Thread.Sleep( 1);

progressBar1.Va lue += 1;

}

Conn.Close();

}
private void setCountries(Da taSetOld.E7saey a_Country_ListR ow[]
e7saeya_Country _ListRows, int old_E7sa2ya_ID, int new_A7sa2ya_ID)

{

ni_Country = new NewIndex();

foreach (DataSetOld.E7s aeya_Country_Li stRow row in e7saeya_Country _ListRows)

{

DataSetOld.E7sa eyaDetailsRow[] rows =
(DataSetOld.E7s aeyaDetailsRow[])row.GetChildRo ws("Rel_Country _Mo2");
int country_id = ni_Ahsa2yat.Get Index("Country" );

int sucess =
this.sqlCommand Param(Ins_Count ry,country_id,r ow.E7saeya_Coun try_Name);

if(sucess == 1)

{

ni_Country.Upda teIndex("Countr y");

this.setAHCount ry(rows, row.E7saeya_Cou ntry_ID, new_A7sa2ya_ID, country_id);

}

else

{

SelCountryID.Pa rameters["@NAME"].Value = row.E7saeya_Cou ntry_Name;

int exist_id = (int)SelCountry ID.ExecuteScala r();

this.setAHCount ry(rows, row.E7saeya_Cou ntry_ID, new_A7sa2ya_ID, exist_id);

}

}

}
private void setAHCountry(Da taSetOld.E7saey aDetailsRow[] e7saeyaDetailsR ows,
int old_AH_Country_ ID, int new_A7sa2ya_ID, int new_country_id)

{

ni_Ah_Country = new NewIndex();

int ah_country_id = ni_Ah_Country.G etIndex("Ahsa2_ Country");

int success =
this.sqlCommand Param(Ins_AhCou ntry,ah_country _id,new_A7sa2ya _ID,new_country _
id);

if(success == 1)

{

ni_Ah_Country.U pdateIndex("Ahs a2_Country");

setMo2shrat(e7s aeyaDetailsRows , old_AH_Country_ ID, ah_country_id);

}

}

############### # CODE END ############### #####

My Company was using Delphi and I'm megrate everything to C#.. My way work
well but take to much time and memory, The old Delphi Code was doing this
task in 20% of the time and don't use so much system resources like mine?!

Is there better way to copy my data with the new shcema??

thanx
Nov 17 '05 #1
0 944

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
22525
by: Michael Wein | last post by:
Hello, does anyone know of a way/solution how to convert XML Schema documents into DTD? I am aware of the fact that such a conversion won't be possible under certain circumstances and that probably some information loss will occur (esp. data types). However, in many cases it should be possible to obtain at least the structure of the XSD. Any help would be greatly appreciated. Thanks in advance. --
4
2016
by: dschl | last post by:
Hi, I'm converting an Access 2000 database to Sql Server and must be missing something obvious. Using the Import utility in Sql Server, the Access queries seem to get executed and the resultant data imported as tables. Oops! Using the Upsize lizard in Access 2003, the queries aren't even in the selection list of "tables" to upsize. It looks like the Upsize wizard
2
5856
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 ...... Deadlocked Statement: Type : Dynamic Operation: Execute
1
5186
by: SLC via DBMonster.com | last post by:
Hello I'm a newbie to this and I need help, please My question is, we currently have a IDMS db and will be converting to DB2. What are the things I should do? The IDMS has not been documented very well, and there are a number of duplicate fields. I was thinking about documenting all the tables with fields attributes, and documenting the fields to the 150 screens in this program. We also that about doing a CRUD matrix to see what it...
4
5734
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.