cannot connect to the database during deployment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • broken472000
    New Member
    • Aug 2008
    • 1

    cannot connect to the database during deployment

    Hi,

    i developed one web application using visual studio 2005. before deployment it runs perfectly. when i deployed and try to access pages, i get the following errors. i am using sql server 2005 management studio.what i have to do for avoiding this problem. plz help me.


    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    ExecuteReader requires an open and available Connection. The connection's current state is closed.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidO perationExcepti on: ExecuteReader requires an open and available Connection. The connection's current state is closed.

    Source Error:


    Line 43: {
    Line 44: dbc = new OleDbCommand(qu ery, db);
    Line 45: mr = dbc.ExecuteRead er();
    Line 46: return mr;
    Line 47: }


    Source File: c:\Inetpub\wwwr oot\App_Code\Cl assLeave.cs Line: 45

    Stack Trace:


    [InvalidOperatio nException: ExecuteReader requires an open and available Connection. The connection's current state is closed.]
    System.Data.Ole Db.OleDbConnect ion.CheckStateO pen(String method) +1061115
    System.Data.Ole Db.OleDbCommand .ValidateConnec tion(String method) +22
    System.Data.Ole Db.OleDbCommand .ValidateConnec tionAndTransact ion(String method) +15
    System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior behavior, String method) +51
    System.Data.Ole Db.OleDbCommand .ExecuteReader( CommandBehavior behavior) +111
    System.Data.Ole Db.OleDbCommand .ExecuteReader( ) +6
    ClassLeave.sele ct(String query) in c:\Inetpub\wwwr oot\App_Code\Cl assLeave.cs:45
    Login.btnLogin_ Click(Object sender, EventArgs e) in c:\Inetpub\wwwr oot\Default.asp x.cs:70
    System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105
    System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument) +107
    System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +7
    System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
    System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.507 27.42; ASP.NET Version:2.0.507 27.42
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi broken472000,

    Welcome to Bytes! I hope you find the site useful.

    There is a problem with your connection object which means that it couldn't open. There must be some difference between the setup on your development machine and your deployment machine. For instance, does your connection require an ODBC to be set up on your deployment machine?

    How are you connecting to the database?

    Dr B

    Comment

    Working...