Click here to Skip to main content
16,004,458 members
Home / Discussions / Database
   

Database

 
GeneralRe: Calling sp_helptext from ASPNET Pin
Hans Ruck10-Dec-04 6:18
Hans Ruck10-Dec-04 6:18 
GeneralRe: Calling sp_helptext from ASPNET Pin
tojamismis10-Dec-04 11:28
tojamismis10-Dec-04 11:28 
GeneralRe: Calling sp_helptext from ASPNET Pin
Edbert P12-Dec-04 13:34
Edbert P12-Dec-04 13:34 
GeneralGenerate generalized insert, delete and update statements Pin
CNU9-Dec-04 16:10
CNU9-Dec-04 16:10 
GeneralRe: Generate generalized insert, delete and update statements Pin
Colin Angus Mackay10-Dec-04 5:59
Colin Angus Mackay10-Dec-04 5:59 
QuestionServer -- keep connection open? Or open/close as needed? Pin
Judah Gabriel Himango9-Dec-04 6:32
sponsorJudah Gabriel Himango9-Dec-04 6:32 
AnswerRe: Server -- keep connection open? Or open/close as needed? Pin
Alex Korchemniy9-Dec-04 10:55
Alex Korchemniy9-Dec-04 10:55 
GeneralRe: Server -- keep connection open? Or open/close as needed? Pin
Judah Gabriel Himango9-Dec-04 11:45
sponsorJudah Gabriel Himango9-Dec-04 11:45 
Thanks for the reply. As I mentioned in the first post, my current code opens and closes on demand, just as you suggest. However, once I've got simultaneous SQL commands being executed/queried, what then?

For example, consider the following:

void DoTwoThingsAtOnce()
{
   Thread reader = ReadSomeStuff();
   Thread doer = DoSomeStuff();

   reader.Start();
   doer.Start();
}

SqlConnection connection;
void ReadSomeStuff()
{
   connection.Open();
   ...
   connection.Close();
}

void DoSomeStuff()
{
   connection.Open();
   // do some lengthy operation here
   connection.Close();
}


The above code will begin executing ReadSomeStuff and DoSomeStuff both on different threads. When ReadSomeStuff finishes, it will close the connection -- but alas, DoSomeStuff is not finished with the connection, so closing it will cause DoSomeStuff to fail.

Should I instead be creating connections objects for each operation?

Any remotely useful information on my blog will be removed immediately.

There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango


GeneralRe: Server -- keep connection open? Or open/close as needed? Pin
Mike Dimmick10-Dec-04 2:28
Mike Dimmick10-Dec-04 2:28 
GeneralRe: Server -- keep connection open? Or open/close as needed? Pin
Judah Gabriel Himango10-Dec-04 4:29
sponsorJudah Gabriel Himango10-Dec-04 4:29 
AnswerRe: Server -- keep connection open? Or open/close as needed? Pin
Dave Kreskowiak10-Dec-04 9:56
mveDave Kreskowiak10-Dec-04 9:56 
GeneralRe: Server -- keep connection open? Or open/close as needed? Pin
Judah Gabriel Himango10-Dec-04 10:00
sponsorJudah Gabriel Himango10-Dec-04 10:00 
GeneralStored Procedure using Disconnected Recordset Pin
web_app_developer9-Dec-04 4:00
web_app_developer9-Dec-04 4:00 
GeneralRe: Stored Procedure using Disconnected Recordset Pin
tojamismis10-Dec-04 12:42
tojamismis10-Dec-04 12:42 
GeneralSQL Server 2000 / Access Pin
| Muhammad Waqas Butt |9-Dec-04 1:08
professional| Muhammad Waqas Butt |9-Dec-04 1:08 
GeneralInsert photos and files Pin
CNU8-Dec-04 14:46
CNU8-Dec-04 14:46 
GeneralRe: Insert photos and files Pin
Alex Korchemniy8-Dec-04 16:55
Alex Korchemniy8-Dec-04 16:55 
GeneralRe: Insert photos and files Pin
CNU8-Dec-04 17:39
CNU8-Dec-04 17:39 
GeneralRe: Insert photos and files Pin
Alex Korchemniy9-Dec-04 10:53
Alex Korchemniy9-Dec-04 10:53 
GeneralRe: Insert photos and files Pin
Mekong River9-Dec-04 4:18
Mekong River9-Dec-04 4:18 
GeneralSQL query Pin
Paps28-Dec-04 3:49
Paps28-Dec-04 3:49 
GeneralRe: SQL query Pin
Yulianto.8-Dec-04 15:58
Yulianto.8-Dec-04 15:58 
GeneralRe: SQL query Pin
Alex Korchemniy8-Dec-04 17:02
Alex Korchemniy8-Dec-04 17:02 
GeneralRunning Batch Files - Windows Pin
sweep1237-Dec-04 22:24
sweep1237-Dec-04 22:24 
GeneralRe: Accessing SQL Server without static IP Pin
Steve S7-Dec-04 1:33
Steve S7-Dec-04 1:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.