Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Use mySQL 5.0 with Visual Studio 2005

Posted on 2009-04-05
11
Medium Priority
?
315 Views
Last Modified: 2013-11-26
Hey,

I know there is many ways to use mySQL with Visual Studio 2005. The problem is that I need to switch back to MS SQL 2005 easily. Right now I have a global constant containing this connection string to sql 2005:

public const string DBConn = "Data Source=localhost;Initial Catalog=NAITBook Integrated Security=SSPI";

I was hoping that there was a way to just change this string to allow me to connect to mySQL.

0
Comment
Question by:tqrecords
  • 5
  • 5
11 Comments
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 24074516
>>I was hoping that there was a way to just change this string to allow me to connect to mySQL

The connection objects are different from MS SQL and MySQL, I very doubt you can do it by just changing the ConnectionString setting.

However, you may try look for the ado.net odbc objects.
0
 
LVL 4

Expert Comment

by:CraigLazar
ID: 24074555
Hi,
Depends on your process that u are using to connect, what i do is store the connection string in a config file, so depending on the application, and how the user is working, you can switch automatically between settings. So when my application start up, i have a function which opens a simple config file in the applications folder and then it reads an Entry called "CurrentDBConnection", and this then holds hte value of my db connection string. Like ryancys comment, the data connection inside ur code will be different from SQL to MySql, so in your code u can code around this depending on your value in the confg file. So if its the MySQL conneciton then set the MySQL db connection objects, and the same thn for the SQL connections objects  in run time - How is ur application designed? - do you have a GUI front end?
Hope this Helps
0
 

Author Comment

by:tqrecords
ID: 24074582
Hey,

Well all I need right now really is to be able to test my application with mySQL. It is because I do not have SQL Server 2005 installed on my computer.

My application has a front end and a back end. The front end is an AJAX enabled website. This is how I connect to the SQL 2005 Server right now

using (SqlConnection DBConn = new SqlConnection(GlobalConstants.DBConn))

The back end contains the GlobalConstants class which establishes the connection.

All I want to know it the quickest and easiest way to connect to mySQL and be able to change it back to the current set up without too much difficulty. Mainly because I have a project thats due tomorrow and I won't have much time to change the settings!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 54

Expert Comment

by:Ryan Chong
ID: 24074607
>>It is because I do not have SQL Server 2005 installed on my computer.

You can try download the SQL Server Express Edition from M$ website...

http://msdn.microsoft.com/en-au/sqlserver/bb671254.aspx
0
 

Author Comment

by:tqrecords
ID: 24074640
You know what???

I had a problem installing SQL Server 2005 Dev Addition because of this stupid corrupt sql.cab error AND I SERIOUSLY RESEARCHED AND TRIED EVERYTHING to try to install it and it would not F&#*%^G WORK!

Does the express addition come with the GUI where you can add tables and such? I am downloading it right now.

If it does then I don't need any of this mySQL bullsh*&t.
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 24074651
0
 

Author Comment

by:tqrecords
ID: 24074922
Hey,

Every thing is installed but I cannot connect to SQL. I receive this error:

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

I have made sure that:

1. windows firewall is off
2. SQL Server Browser service is turned on
3. remote connections is enabled

??
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 24074944
0
 

Author Comment

by:tqrecords
ID: 24074953
yes, i did already, followed all the steps and it still doesn't connect..
0
 
LVL 54

Accepted Solution

by:
Ryan Chong earned 1500 total points
ID: 24075005
0
 

Author Comment

by:tqrecords
ID: 24093378
yeah one of those out of 100 solutions worked..

I had to change the connection string to:

public const string DBConn = "Server=.\\SQLEXPRESS;Initial Catalog="database";Integrated Security=SSPI";

thanks for the help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

876 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