Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


setting a connection with database?

Posted on 2003-03-14
Medium Priority
Last Modified: 2010-04-15
string myConnectString = "Server=localhost;Database=test;Uid=john;Pwd=pass";
SqlConnection MyConn = new SqlConnection(myConnectString);

when i run the code, it says access denied or server doesnt exist. but i set up the database using MySql. advice? tnx
Question by:amgln
1 Comment
LVL 22

Accepted Solution

Mohammed Nasman earned 150 total points
ID: 8138200

  You are using the SqlConnection to connect to MySql, Sqlconnection designed for MS Sql Server 7/2000 only and will not work with other DB, try to use OleDBConnection if you have OleDB driver for MySql, or Install ODBC.Net to access MySql using the ODBC

Best regards
Mohammed Nasman

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month10 days, 17 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question