Re: Waiting for MSDE

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jeff (jeff_nospam_at_eNetPortals.com)
Date: 08/26/04


Date: Thu, 26 Aug 2004 16:42:58 GMT

Thanks Steven -

Problem solved.

I still don't understand why a connection open must wait several seconds
after the service reports 'Running'. Can you explain what's going on???

- Jeff

"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:fZoTXAziEHA.3628@cpmsftngxa10.phx.gbl...
> Hi Jeff,
>
> In addition to wait for a certain period of time, I think we can also try
> another means on this. Since if the service hasn't been started, we'll get
> failed(exception) when intializing the SqlConnection, yes?
>
> Thus, we can define a function to do the connection initializing, it use a
> try{...}catch(){...} block in it, and when get error , checking the
> exception type, if it means the service not completely started, return a
> certain value.
>
> And in the function's caller, use a while loop the constantly make the
> intialization call. For example:
> ==================================
> Function MSDE_INIT() As Integer
>
>
> Try
> frmMain.conSC = New SqlConnection(strConn)
> frmMain.conSC.ConnectionString = strConn
> frmMain.conSC.Open()
> Return 1
> Catch ex As Exception
> 'exception checking
>
> Return 0
> End Try
> End Function
> =======================================
>
> call it as
>
> While Not MSDE_INIT() = 1
>
> End While
>
> Also, you can sleep for serveral seconds in the while loop if you feel it
> will block your application
>
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
>
>



Relevant Pages

  • Re: Error when entering wrong data type in do-while loop
    ... Jeff wrote: ... > I have homework for a larger program than shown below but the code below ... > The concept is 'that the loop should work under all conditions'. ... > At the moment if a character is entered, the result is that the screen ...
    (comp.lang.cpp)
  • Re: 2 column display - HELP SQL/ASP
    ... Thanks Jeff - this certainly helped me understand what the code is I have. ... The question I have now is - I understand the loop part on the TD's, ... if objRs.EOF then exit do ... >>Dim allStores, numOfStore ...
    (microsoft.public.inetserver.asp.db)
  • Re: Random not being so random
    ... Jeff, ... Basically your loop is fast enough that the seed that Random is deriving ... |I was testing out some code to create a string of random characters. ... | Dim rGen as New Random ...
    (microsoft.public.dotnet.languages.vb)
  • Re: looping question
    ... first set of records, and not the second. ... >> want to get rid of, is having the extra column on the right that says ...
    (microsoft.public.inetserver.asp.general)