Click here to Skip to main content
15,913,669 members
Home / Discussions / C#
   

C#

 
Questionuse connection from login form in other forms Pin
Newkid on the block31-Oct-20 5:43
Newkid on the block31-Oct-20 5:43 
AnswerRe: use connection from login form in other forms Pin
OriginalGriff31-Oct-20 5:57
mveOriginalGriff31-Oct-20 5:57 
GeneralRe: use connection from login form in other forms Pin
Newkid on the block31-Oct-20 10:21
Newkid on the block31-Oct-20 10:21 
GeneralRe: use connection from login form in other forms Pin
Dave Kreskowiak31-Oct-20 11:26
mveDave Kreskowiak31-Oct-20 11:26 
AnswerRe: use connection from login form in other forms Pin
Dave Kreskowiak31-Oct-20 6:30
mveDave Kreskowiak31-Oct-20 6:30 
If you're creating a connection to the database in your login form to share amongst all other forms, DON'T.

All database operations should be Create Connection as late as possible, do your work, and close connection as early as possible.

DO NOT HOLD A DATABASE CONNECTION OPEN FOR THE LIFE OF YOUR APP.

Also, is a login form really the correct place to open a database connection used by the entire app? Does it have anything to do with the operation of authenticating users in your app?

No, it does not. That is a violation of "separation of concerns". The authentication form should be limited to just that, getting the user credentials and authenticating them. That's it. Nothing else.

The database work should be handled different classes specific to their tasks.

AnswerRe: use connection from login form in other forms Pin
BillWoodruff1-Nov-20 15:12
professionalBillWoodruff1-Nov-20 15:12 
GeneralRe: use connection from login form in other forms Pin
Newkid on the block3-Nov-20 5:45
Newkid on the block3-Nov-20 5:45 
GeneralRe: use connection from login form in other forms Pin
BillWoodruff3-Nov-20 14:46
professionalBillWoodruff3-Nov-20 14:46 
QuestionCrystal reports and datagridviews Pin
Damir Djordjevic31-Oct-20 4:39
Damir Djordjevic31-Oct-20 4:39 
AnswerRe: Crystal reports and datagridviews Pin
Gerry Schmitz31-Oct-20 5:15
mveGerry Schmitz31-Oct-20 5:15 
QuestionIF Else statement on background colour of label. Pin
Member 1497767230-Oct-20 2:29
Member 1497767230-Oct-20 2:29 
SuggestionRe: IF Else statement on background colour of label. Pin
Richard MacCutchan30-Oct-20 2:36
mveRichard MacCutchan30-Oct-20 2:36 
GeneralRe: IF Else statement on background colour of label. Pin
Member 1497767230-Oct-20 2:47
Member 1497767230-Oct-20 2:47 
GeneralRe: IF Else statement on background colour of label. Pin
OriginalGriff30-Oct-20 2:52
mveOriginalGriff30-Oct-20 2:52 
AnswerRe: IF Else statement on background colour of label. Pin
OriginalGriff30-Oct-20 2:50
mveOriginalGriff30-Oct-20 2:50 
GeneralRe: IF Else statement on background colour of label. Pin
Member 1497767230-Oct-20 3:01
Member 1497767230-Oct-20 3:01 
QuestionAdd treasure to my maze game Pin
Member 1497767229-Oct-20 4:10
Member 1497767229-Oct-20 4:10 
AnswerRe: Add treasure to my maze game Pin
OriginalGriff29-Oct-20 4:20
mveOriginalGriff29-Oct-20 4:20 
AnswerRe: Add treasure to my maze game Pin
Gerry Schmitz29-Oct-20 5:14
mveGerry Schmitz29-Oct-20 5:14 
QuestionIs it possible to save DataGridView contents to a file with a specific suffix which can be loaded just by my own application? Pin
Alex Dunlop28-Oct-20 8:09
Alex Dunlop28-Oct-20 8:09 
AnswerRe: Is it possible to save DataGridView contents to a file with a specific suffix which can be loaded just by my own application? Pin
Dave Kreskowiak28-Oct-20 9:21
mveDave Kreskowiak28-Oct-20 9:21 
AnswerRe: Is it possible to save DataGridView contents to a file with a specific suffix which can be loaded just by my own application? Pin
OriginalGriff28-Oct-20 9:27
mveOriginalGriff28-Oct-20 9:27 
AnswerRe: Is it possible to save DataGridView contents to a file with a specific suffix which can be loaded just by my own application? Pin
Gerry Schmitz28-Oct-20 18:31
mveGerry Schmitz28-Oct-20 18:31 
QuestionMouse enter to new form Pin
Member 1497767228-Oct-20 5:01
Member 1497767228-Oct-20 5:01 
AnswerRe: Mouse enter to new form Pin
Richard MacCutchan28-Oct-20 5:44
mveRichard MacCutchan28-Oct-20 5:44 

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.