Click here to Skip to main content
16,017,788 members
Home / Discussions / C#
   

C#

 
GeneralRe: tags - how to? Pin
Colin Angus Mackay5-Aug-07 5:50
Colin Angus Mackay5-Aug-07 5:50 
Questioninternet cafe software - help needed Pin
Jassim Rahma4-Aug-07 3:21
Jassim Rahma4-Aug-07 3:21 
AnswerRe: internet cafe software - help needed Pin
The ANZAC4-Aug-07 13:02
The ANZAC4-Aug-07 13:02 
GeneralRe: internet cafe software - help needed Pin
Jassim Rahma5-Aug-07 5:56
Jassim Rahma5-Aug-07 5:56 
QuestionHow can I access an html element in frame. Pin
VahagnSC4-Aug-07 0:37
VahagnSC4-Aug-07 0:37 
AnswerRe: How can I access an html element in frame. Pin
George L. Jackson4-Aug-07 6:20
George L. Jackson4-Aug-07 6:20 
QuestionWindows form global object Pin
Krugger4044-Aug-07 0:22
Krugger4044-Aug-07 0:22 
AnswerRe: Windows form global object [modified] Pin
Colin Angus Mackay4-Aug-07 0:31
Colin Angus Mackay4-Aug-07 0:31 
datastruct wrote:
I am currently building a window application and i want the system to use a single database connection for all its queries. So, i want to created a global connection object on login and use this very same object throughout my application when a database connection is required. Can you please help me on this?


What you actually want to do is create a DAL (Data Access/Abstraction Layer) class (or classes).

The DAL is either going to be a singleton or a static class.

Here is a very basic example:
public static Dal
{
    private static SqlConnection theConnection;
 
    public static ConnectionString
    {
        set
        {
            theConnection = new SqlConnection(value)
        }
    }
 
    public static DataSet SomeQuery(int id)
    {
        // Write the code to perform the query here.
    }
}



-- modified at 6:50 Saturday 4th August, 2007
(Corrected code)


Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...

"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."


My website

GeneralRe: Windows form global object Pin
Christian Graus4-Aug-07 0:47
protectorChristian Graus4-Aug-07 0:47 
GeneralRe: Windows form global object Pin
Colin Angus Mackay4-Aug-07 0:50
Colin Angus Mackay4-Aug-07 0:50 
GeneralRe: Windows form global object Pin
Krugger4044-Aug-07 0:58
Krugger4044-Aug-07 0:58 
AnswerRe: Windows form global object Pin
Manoj Kumar Rai4-Aug-07 0:49
professionalManoj Kumar Rai4-Aug-07 0:49 
GeneralRe: Windows form global object Pin
Colin Angus Mackay4-Aug-07 0:52
Colin Angus Mackay4-Aug-07 0:52 
QuestionHow to open and read a file as a unicode char Pin
Life as a Coder3-Aug-07 23:32
Life as a Coder3-Aug-07 23:32 
AnswerRe: How to open and read a file as a unicode char Pin
Luc Pattyn3-Aug-07 23:52
sitebuilderLuc Pattyn3-Aug-07 23:52 
GeneralRe: How to open and read a file as a unicode char Pin
Life as a Coder4-Aug-07 0:03
Life as a Coder4-Aug-07 0:03 
GeneralRe: How to open and read a file as a unicode char Pin
Luc Pattyn4-Aug-07 0:17
sitebuilderLuc Pattyn4-Aug-07 0:17 
AnswerRe: How to open and read a file as a unicode char [modified] Pin
Guffa4-Aug-07 0:51
Guffa4-Aug-07 0:51 
AnswerRe: How to open and read a file as a unicode char Pin
Mike Dimmick4-Aug-07 3:36
Mike Dimmick4-Aug-07 3:36 
QuestionIs it possible to enable controls on the form from a class. Pin
Janu_M3-Aug-07 23:23
Janu_M3-Aug-07 23:23 
AnswerRe: Is it possible to enable controls on the form from a class. Pin
Luc Pattyn3-Aug-07 23:54
sitebuilderLuc Pattyn3-Aug-07 23:54 
GeneralRe: Is it possible to enable controls on the form from a class. Pin
Janu_M4-Aug-07 0:11
Janu_M4-Aug-07 0:11 
GeneralRe: Is it possible to enable controls on the form from a class. Pin
Colin Angus Mackay4-Aug-07 0:26
Colin Angus Mackay4-Aug-07 0:26 
GeneralRe: Is it possible to enable controls on the form from a class. Pin
Luc Pattyn4-Aug-07 0:32
sitebuilderLuc Pattyn4-Aug-07 0:32 
AnswerRe: Is it possible to enable controls on the form from a class. Pin
Developer6114-Aug-07 0:14
Developer6114-Aug-07 0:14 

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.