Database Connection Error In Asp.net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Asp.Net Application Database Connection issue up vote 3 down vote favorite 1 When I try to write in C# a connection to my app to my database, I build the application successfully in Visual Studio 2005 but when I run the site in debugger i get an error: Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 118. Here is the connection code that is giving the error: SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Server"].ConnectionString); I have the connection string written correctly in my web.config, file so im clueless on what this remotely means. Im not sure if im missing anything. Any help appreciated. Here is my entire code for the section that might help: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Web.Configuration; using System.Data.SqlClient; public partial class RateAnalyzerPage: System.Web.UI.Page { protected void Search_Click(object sender, EventArgs e) { string IDnumber = mechantNumber.Text; string selectSQL = "SELECT FROM Authors Where MID='"+ IDnumber +"'"; // SqlConnection con = new SqlConnection(@"Server="); //SqlConnection con = new SqlConnection(); SqlConnection con = new SqlConnection(System.Configu
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual http://stackoverflow.com/questions/11639320/asp-net-application-database-connection-issue Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question http://www.codeproject.com/Questions/301397/How-to-handle-ASP-Net-application-Errors-like-fail Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ How to handle ASP.Net application Errors like failed to connect to Database Rate this: Please Sign up or sign in to vote. See more: VS2005 C# ASP.NET Visual-Studio , + Hi everybody, I want to handle Errors in my ASP.Net application, Example: When try to access Database and the connection is failed, i want to go to Error Page, I try to use web config file like that:
360 games PC games https://support.microsoft.com/en-us/kb/316989 Windows games Windows phone games Entertainment All Entertainment https://www.godaddy.com/help/connecting-to-a-mysql-database-using-aspnet-7331 Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security Internet database connection Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Lumia All database connection error Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States) Terms of use Privacy & cookies Trademarks © 2016 Microsoft
Name:VIP Acct Exec:Pro DashboardMy ProductsAccount SettingsMy RenewalsLog OutLog InMenuHelpGetting StartedCommunitySystem StatusBack|Home Full SiteCommunityHelpWeb & Classic HostingHelpWindows Hosting (Plesk)GoDaddy Help24/7 Support (480) 505-8877Connecting to a MySQL Database Using ASP.NETThis example describes using ASP.NET/MySql.Data to connect to a MySQL Database. A few important things you need before you get started: Knowledge of computer programming. Microsoft® Visual Studio .NET. MySql Connector/NET on your development computer. For more information, click here. Knowledge of MySql and specifically the MySql.Data Namespace. A setup MySql Database. For more information, see Create MySQL or MS SQL databases. To Connect to a MySQL Database Using ASP.NET Find your database's connection strings (Web & Classic / Plesk). Change the your password value to your real database password value. Using Microsoft Visual Studio .NET create an ASP.NET Project. Add a reference to MySql.Data.dll. Replace the value in the following code with your_ConnectionString with your database information. Insert the following code into your project including your modified your_ConnectionString value: NOTE: If your MySql database was created with the Allow Direct Database Access enabled, you can connect to the database from your development computer. If you did not enable Allow Direct Database Access, your MySql is in a secure environment and you cannot connect to the database from your development computer. A connection can only be successful when your code is deployed to the hosting site.
MySql.Data.MySqlClient.MySqlConnection mySqlConnection = new
MySql.Data.MySqlClient.MySqlConnection();
mySqlConnection.ConnectionString = “your_ConnectionString”;
try
{
mySqlConnection.Open();
switch (mySqlConnection.State)
{
case System.Data.ConnectionState.Open:
// Connection has been made
break;
case System.Data.ConnectionState.Closed:
// Connection could not b