473,324 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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.EventArgs e)

{

this.transActionStart();

}

private void transActionStart()

{

progressBar1.Value = 0;

adp_Old_E7sea2ya.Fill(dsOld.E7saeya_List);

adp_Old_Country_list.Fill(dsOld.E7saeya_Country_Li st);

adp_Old_Mo2shrat.Fill(dsOld.E7saeyaDetails);

adp_Old_Mo2_Details.Fill(dsOld.E7saeya_Main);

progressBar1.Maximum = dsOld.E7saeya_List.Rows.Count;

this.setAhsa2yat();

}

private void setAhsa2yat()

{

ni_Ahsa2yat = new NewIndex();

foreach (DataSetOld.E7saeya_ListRow row in dsOld.E7saeya_List)

{

int ah_id = ni_Ahsa2yat.GetIndex("Ahsa2yat");

int succ = this.sqlCommandParam(Ins_Ahsa2ya, ah_id, row.E7saeya_Name);

if (succ == 1)

{

ni_Ahsa2yat.UpdateIndex("Ahsa2yat");

DataSetOld.E7saeya_Country_ListRow[] rows=
(DataSetOld.E7saeya_Country_ListRow[])row.GetChildRows("Rel_AH_Country");

this.setCountries(rows, row.E7saeya_ID, ah_id);

}
System.Threading.Thread.Sleep(1);

progressBar1.Value += 1;

}

Conn.Close();

}
private void setCountries(DataSetOld.E7saeya_Country_ListRow[]
e7saeya_Country_ListRows, int old_E7sa2ya_ID, int new_A7sa2ya_ID)

{

ni_Country = new NewIndex();

foreach (DataSetOld.E7saeya_Country_ListRow row in e7saeya_Country_ListRows)

{

DataSetOld.E7saeyaDetailsRow[] rows =
(DataSetOld.E7saeyaDetailsRow[])row.GetChildRows("Rel_Country_Mo2");
int country_id = ni_Ahsa2yat.GetIndex("Country");

int sucess =
this.sqlCommandParam(Ins_Country,country_id,row.E7 saeya_Country_Name);

if(sucess == 1)

{

ni_Country.UpdateIndex("Country");

this.setAHCountry(rows, row.E7saeya_Country_ID, new_A7sa2ya_ID, country_id);

}

else

{

SelCountryID.Parameters["@NAME"].Value = row.E7saeya_Country_Name;

int exist_id = (int)SelCountryID.ExecuteScalar();

this.setAHCountry(rows, row.E7saeya_Country_ID, new_A7sa2ya_ID, exist_id);

}

}

}
private void setAHCountry(DataSetOld.E7saeyaDetailsRow[] e7saeyaDetailsRows,
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.GetIndex("Ahsa2_Country");

int success =
this.sqlCommandParam(Ins_AhCountry,ah_country_id,n ew_A7sa2ya_ID,new_country_
id);

if(success == 1)

{

ni_Ah_Country.UpdateIndex("Ahsa2_Country");

setMo2shrat(e7saeyaDetailsRows, 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 928

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

Similar topics

10
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...
4
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...
2
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 .........
1
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...
4
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.