473,508 Members | 4,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Seek advice on 2 SqlConnections algorithm

Tom
Hi,

I wrote a win application which use DataReader and while
(reader.Read()) to read a table's data and then assign
them to local variables for other methods to use.

It is the first sqlconnection.

Insides the while loop, I need to call a StoredProcedure
to insert the data to another table. So, I made the 2nd
sqlconnection insides the while loop of the 1st
sqlconnection.

They work fine. But, I think there should be better
algorithm, e.g. just to use one SqlConnection.

Anyone could give me some advice?

Thanks
Nov 15 '05 #1
2 1026
You might want to consider just putting your data into a dataset, and then
looping through that to call the stored procedure.

"Tom" <ke*****@yahoo.com> wrote in message
news:09****************************@phx.gbl...
Hi,

I wrote a win application which use DataReader and while
(reader.Read()) to read a table's data and then assign
them to local variables for other methods to use.

It is the first sqlconnection.

Insides the while loop, I need to call a StoredProcedure
to insert the data to another table. So, I made the 2nd
sqlconnection insides the while loop of the 1st
sqlconnection.

They work fine. But, I think there should be better
algorithm, e.g. just to use one SqlConnection.

Anyone could give me some advice?

Thanks

Nov 15 '05 #2
Tom
But, I need to pass each row of data to another method one
by one.

DataSet will fill all data from the sqlDataAdapter.
-----Original Message-----
You might want to consider just putting your data into a dataset, and thenlooping through that to call the stored procedure.

"Tom" <ke*****@yahoo.com> wrote in message
news:09****************************@phx.gbl...
Hi,

I wrote a win application which use DataReader and while
(reader.Read()) to read a table's data and then assign
them to local variables for other methods to use.

It is the first sqlconnection.

Insides the while loop, I need to call a StoredProcedure
to insert the data to another table. So, I made the 2nd
sqlconnection insides the while loop of the 1st
sqlconnection.

They work fine. But, I think there should be better
algorithm, e.g. just to use one SqlConnection.

Anyone could give me some advice?

Thanks

.

Nov 15 '05 #3

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

Similar topics

1
4205
by: Waitman Gobble | last post by:
Hello, I am new to Python. I am having trouble with zipfile.py. On a Linux machine with python 2.4.2 I have trouble opening a zipfile. Python is complaining about the bit where it does a...
39
3936
by: Arvind Varma Kalidindi | last post by:
Hi, I was asked this question in an interview recently. "How do you move to the 6th byte in a file?" ... My thinking would be to find the data types in the file, set a base pointer and advance it...
4
1080
by: Ben | last post by:
Hi I have a question concerning SqlConnections and when they should be opened and closed. Right now I have a database utilities class. I instantiate it when in page_load and dispose it in...
4
1222
by: Olaf Baeyens | last post by:
I do not want to start a ASP versus PHP discussion, because I favour ASP(X), but I seek advice since I have no clue about PHP yet. I want to work with a friend on some web designs. At this point...
1
9586
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
59
7433
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
2
1515
by: Carl R. Davies | last post by:
I want to find a character within a string then copy from that character to the end into another string and erase it from the original. But I'm not sure which of the many algorithms I should use,...
2
2547
by: Number 11950 - GPEMC! Replace number with 11950 | last post by:
HTML to RTF conversion is done by the clipboard in certain circumstances. Does anyone know of an API or possibly a Framework2 class.method that will convert HTML to RTF...? TIA -- Timothy...
2
3911
by: mhearne808[insert-at-sign-here]gmail[insert-dot-he | last post by:
I'm having a problem with the File object's seek() method. Specifically, I cannot use it to seek to a location in a binary file that is greater than 2^31 (2147483648). This seems unnecessarily...
0
7228
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,...
0
7332
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,...
0
7393
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...
1
7058
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...
0
5635
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,...
1
5057
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...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
426
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...

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.