Solved

Use mySQL 5.0 with Visual Studio 2005

Posted on 2009-04-05
11
308 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 51

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 51

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 51

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 51

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 51

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 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