Server Error in '/dataBasee' Application. Format of the initialization string does no

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishal119111
    New Member
    • Oct 2016
    • 1

    Server Error in '/dataBasee' Application. Format of the initialization string does no

    i have got an error


    Server Error in '/dataBasee' Application.
    Format of the initialization string does not conform to specification starting at index 0.
    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.Argument Exception: Format of the initialization string does not conform to specification starting at index 0.

    Source Error:


    Line 43: _Conn = new Connection();
    Line 44: string a = Convert .ToString (_Conn.GetCon() );
    Line 45: _con.Connection String = a;
    Line 46: _cmd =new SqlCommand ("insert into employee(Name,A ddress) values('"+this ._empName+"','" +this ._empAddr +"')",_con );
    Line 47: _con .Open();


    Source File: c:\Users\vishal \Documents\Visu al Studio 2008\WebSites\d ataBasee\App_Co de\employee.cs Line: 45

    Stack Trace:


    [ArgumentExcepti on: Format of the initialization string does not conform to specification starting at index 0.]
    System.Data.Com mon.DbConnectio nOptions.GetKey ValuePair(Strin g connectionStrin g, Int32 currentPosition , StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +4867618
    System.Data.Com mon.DbConnectio nOptions.ParseI nternal(Hashtab le parsetable, String connectionStrin g, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +129
    System.Data.Com mon.DbConnectio nOptions..ctor( String connectionStrin g, Hashtable synonyms, Boolean useOdbcRules) +98
    System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g) +55
    System.Data.Sql Client.SqlConne ctionFactory.Cr eateConnectionO ptions(String connectionStrin g, DbConnectionOpt ions previous) +24
    System.Data.Pro viderBase.DbCon nectionFactory. GetConnectionPo olGroup(String connectionStrin g, DbConnectionPoo lGroupOptions poolOptions, DbConnectionOpt ions& userConnectionO ptions) +200
    System.Data.Sql Client.SqlConne ction.Connectio nString_Set(Str ing value) +62
    System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value) +4
    employee.AddEmp () in c:\Users\vishal \Documents\Visu al Studio 2008\WebSites\d ataBasee\App_Co de\employee.cs: 45
    _Default.btnIns ert_Click(Objec t sender, EventArgs e) in c:\Users\vishal \Documents\Visu al Studio 2008\WebSites\d ataBasee\Login. aspx.cs:23
    System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +111
    System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument) +110
    System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +10
    System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +36
    System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1565






    plzzz help me......
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    So what I'm reading is that you don't have a database correctly configured.

    If you don't have a connection, asking an empty Connection object for its connection string is kind of silly.

    Or, perhaps you've got a variable name mismatch between _Conn and _con?

    You could use an ODBC connect string in your code, like
    Code:
    String a = "Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;
    Pwd=myPassword;"
    Ref: Microsoft SQL Server ODBC Driver connection strings

    Good Luck!
    Oralloy

    Comment

    Working...