Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use mySQL 5.0 with Visual Studio 2005

Posted on 2009-04-05
11
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 53

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
Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

 
LVL 53

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 53

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 53

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 53

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
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…

704 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