Click here to Skip to main content
15,908,901 members
Home / Discussions / C#
   

C#

 
QuestionMouseLeave event triggered on the wrong window Pin
martingeorgiev7-Jun-10 8:43
martingeorgiev7-Jun-10 8:43 
AnswerRe: MouseLeave event triggered on the wrong window Pin
Andrew Rissing7-Jun-10 8:53
Andrew Rissing7-Jun-10 8:53 
GeneralRe: MouseLeave event triggered on the wrong window Pin
martingeorgiev7-Jun-10 8:57
martingeorgiev7-Jun-10 8:57 
GeneralRe: MouseLeave event triggered on the wrong window Pin
Andrew Rissing7-Jun-10 9:06
Andrew Rissing7-Jun-10 9:06 
GeneralRe: MouseLeave event triggered on the wrong window Pin
Andrew Rissing7-Jun-10 9:17
Andrew Rissing7-Jun-10 9:17 
GeneralRe: MouseLeave event triggered on the wrong window Pin
martingeorgiev7-Jun-10 9:20
martingeorgiev7-Jun-10 9:20 
QuestionRIP BASED SOFTWARE ROUTER FOR WINDOWS using C# Pin
Member 32734627-Jun-10 7:29
Member 32734627-Jun-10 7:29 
Questionusing and close Pin
imbiz7-Jun-10 7:16
imbiz7-Jun-10 7:16 
The first question, if I use "using()" to open a connection,like this:
public void InsertRow(string connectionString, string insertSQL)
{
    using (OleDbConnection connection = new OleDbConnection(connectionString))
    {
        OleDbCommand command = new OleDbCommand(insertSQL);
        command.Connection = connection;

        try
        {
            connection.Open();
            command.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
            return;
        }

    }



Whether I still need to use "connection.Close()" to close the object? Or it will be closed by .Net automatically?

Another question is, Whether "connection.open(),connection.close()" are necessary for a executing every time? For example, there is a querying in Form1.cs and a updating in Form2.cs, should I close the connection in whichever Form immediately ?
AnswerRe: using and close Pin
Keith Barrow7-Jun-10 7:23
professionalKeith Barrow7-Jun-10 7:23 
GeneralRe: using and close Pin
imbiz7-Jun-10 9:20
imbiz7-Jun-10 9:20 
GeneralRe: using and close Pin
Chris Trelawny-Ross7-Jun-10 14:01
Chris Trelawny-Ross7-Jun-10 14:01 
GeneralRe: using and close Pin
imbiz7-Jun-10 14:46
imbiz7-Jun-10 14:46 
GeneralRe: using and close Pin
harold aptroot7-Jun-10 9:51
harold aptroot7-Jun-10 9:51 
AnswerRe: using and close Pin
harold aptroot7-Jun-10 7:25
harold aptroot7-Jun-10 7:25 
GeneralRe: using and close Pin
imbiz7-Jun-10 8:37
imbiz7-Jun-10 8:37 
AnswerRe: using and close Pin
PIEBALDconsult7-Jun-10 13:49
mvePIEBALDconsult7-Jun-10 13:49 
GeneralRe: using and close Pin
imbiz7-Jun-10 14:47
imbiz7-Jun-10 14:47 
AnswerRe: using and close Pin
prasadbuddhika7-Jun-10 18:35
prasadbuddhika7-Jun-10 18:35 
GeneralRe: using and close Pin
imbiz8-Jun-10 1:09
imbiz8-Jun-10 1:09 
Questiontext to speech problem Pin
maryamtooty7-Jun-10 6:08
maryamtooty7-Jun-10 6:08 
AnswerRe: text to speech problem Pin
Anshul R8-Jun-10 20:30
Anshul R8-Jun-10 20:30 
GeneralRe: text to speech problem Pin
maryamtooty11-Jun-10 5:20
maryamtooty11-Jun-10 5:20 
GeneralRe: text to speech problem Pin
Anshul R11-Jun-10 6:16
Anshul R11-Jun-10 6:16 
Questionhtml into cs Pin
genieabdo7-Jun-10 6:02
genieabdo7-Jun-10 6:02 
AnswerRe: html into cs Pin
genieabdo7-Jun-10 7:01
genieabdo7-Jun-10 7:01 

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.