Click here to Skip to main content
15,905,144 members
Home / Discussions / C#
   

C#

 
QuestionCointegration code for C# - not Silverlight Pin
lordoftrades12-Sep-13 22:40
lordoftrades12-Sep-13 22:40 
AnswerRe: Cointegration code for C# - not Silverlight Pin
Pete O'Hanlon13-Sep-13 1:10
mvePete O'Hanlon13-Sep-13 1:10 
GeneralRe: Cointegration code for C# - not Silverlight Pin
lordoftrades15-Sep-13 22:16
lordoftrades15-Sep-13 22:16 
GeneralRe: Cointegration code for C# - not Silverlight Pin
Pete O'Hanlon15-Sep-13 22:40
mvePete O'Hanlon15-Sep-13 22:40 
QuestionHow to generate barcode and qrcode dynamically? Pin
Sahyadri3112-Sep-13 20:51
Sahyadri3112-Sep-13 20:51 
AnswerRe: How to generate barcode and qrcode dynamically? Pin
Richard MacCutchan12-Sep-13 21:54
mveRichard MacCutchan12-Sep-13 21:54 
AnswerRe: How to generate barcode and qrcode dynamically? Pin
AngloThaiSolutions7-Oct-13 4:17
AngloThaiSolutions7-Oct-13 4:17 
QuestionConverting a date format Pin
MarkB12312-Sep-13 2:10
MarkB12312-Sep-13 2:10 
AnswerRe: Converting a date format Pin
MarkB12312-Sep-13 2:30
MarkB12312-Sep-13 2:30 
AnswerRe: Converting a date format Pin
V.12-Sep-13 2:56
professionalV.12-Sep-13 2:56 
GeneralRe: Converting a date format Pin
MarkB12312-Sep-13 3:08
MarkB12312-Sep-13 3:08 
GeneralRe: Converting a date format Pin
V.12-Sep-13 3:16
professionalV.12-Sep-13 3:16 
QuestionAuto Connect SQLConnection Pin
Midnight Ahri12-Sep-13 0:06
Midnight Ahri12-Sep-13 0:06 
SuggestionRe: Auto Connect SQLConnection Pin
Richard MacCutchan12-Sep-13 0:19
mveRichard MacCutchan12-Sep-13 0:19 
QuestionRe: Auto Connect SQLConnection Pin
Midnight Ahri12-Sep-13 3:27
Midnight Ahri12-Sep-13 3:27 
AnswerRe: Auto Connect SQLConnection Pin
Richard MacCutchan12-Sep-13 3:32
mveRichard MacCutchan12-Sep-13 3:32 
AnswerRe: Auto Connect SQLConnection Pin
Midnight Ahri12-Sep-13 5:07
Midnight Ahri12-Sep-13 5:07 
QuestionRe: Auto Connect SQLConnection Pin
Midnight Ahri13-Sep-13 13:57
Midnight Ahri13-Sep-13 13:57 
AnswerRe: Auto Connect SQLConnection Pin
Richard MacCutchan13-Sep-13 22:05
mveRichard MacCutchan13-Sep-13 22:05 
AnswerRe: Auto Connect SQLConnection Pin
Midnight Ahri14-Sep-13 20:12
Midnight Ahri14-Sep-13 20:12 
AnswerRe: Auto Connect SQLConnection Pin
Pete O'Hanlon12-Sep-13 5:18
mvePete O'Hanlon12-Sep-13 5:18 
AnswerRe: Auto Connect SQLConnection Pin
Midnight Ahri12-Sep-13 5:36
Midnight Ahri12-Sep-13 5:36 
QuestionRe: Auto Connect SQLConnection Pin
Midnight Ahri12-Sep-13 6:45
Midnight Ahri12-Sep-13 6:45 
This is what I do,
C#
static async Task<ConnectionState> Method(SqlConnection cnn)
        {
            await cnn.OpenAsync();
            return cnn.State;
        }

C#
private void SQLClientLoader_Load(object sender, EventArgs e)
        {
            do
            {
                this.cnn = new SqlConnection(this.par.Constr);

                try
                {
                    ConnectionState cst = Method(cnn).Result;

                    if (cst == ConnectionState.Open)
                    {
                        this.par.sqSuccess = true;
                    }
                    else
                    {

                    }
                }
                catch (Exception ex)
                {
                    this.par.sqSuccess = false;

                    this.par.Exception = ex.Message;
                }
                finally
                {

                }
            } while ((bool)this.par.sqSuccess != true);
        }


It freeze my application everytime I this form load executed.
Should I combine Task with BackgroundWorker to prevent freeze?
Or maybe something is wrong in my code?
Can you explain to me cause I'm new and confuse of this.
AnswerRe: Auto Connect SQLConnection Pin
Pete O'Hanlon12-Sep-13 8:13
mvePete O'Hanlon12-Sep-13 8:13 
QuestionRe: Auto Connect SQLConnection Pin
Midnight Ahri12-Sep-13 19:36
Midnight Ahri12-Sep-13 19:36 

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.