Solved

Use mySQL 5.0 with Visual Studio 2005

Posted on 2009-04-05
11
298 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 49

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
 
LVL 49

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 49

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 49

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 49

Accepted Solution

by:
Ryan Chong earned 500 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Creating and Managing Databases with phpMyAdmin in cPanel.
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now