Avatar of leon24
leon24

asked on 

Connection String from ASP.Net to mySQL

Hi,

I'm developing a project using Visual Studio 2005 and am using MS SQL server locally to host my database. Now, I need to upload my project to the server, and in the server, it only has mySQL. I've read it that its possible to use mySQL database for ASP.Net applications, is it as easy as changing the web.config file settings to map to the new mySQL database?

The following is the extract of my web.config to database for my local system.

<connectionStrings>
    <add name="PassiongpConnectionString" connectionString="Data Source=DESKTOP;Initial Catalog=PassionGP;Integrated Security=True"/>
  </connectionStrings>

For the server, the
server name is: mysql.readyserver.net
port: 3306
database: fakeDB
username: fakeUser
password: fakePassword

How do I change the connection string of my web.config in order to connect to the database in the server? Any help is appreciated and its very urgent! Thanks! :)
ASP.NETMySQL ServerC#

Avatar of undefined
Last Comment
leon24
ASKER CERTIFIED SOLUTION
Avatar of raja_ind82
raja_ind82
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of leon24
leon24

ASKER

Hi Raja,

Can I just change the settings in web.config file? Anyway I'm using C# for my codes. Thanks for your prompt reply!

Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi leon24;

That all depends. If you used and OleDb provider in your code then yes all you need to do is change the connection string in the web.config file. If you used a SqlClient namespace in your code then no. SqlClient uses a MS specific data provider, objects like SalDataAdapter, SqlConnection and SqlCommand. In this case you will need to add the namespace, using System.Data.OleDb;, to your code and change all references SqlXXX to OleDbXXX and change the connection string in the web.config file. Once this is done then you must test the SQL statements, not all SQL dialects are the same for example In MS Sql variable names are preceded with the @ symbol and in others they use the ? to send values to the SQL statement.

Fernando
Avatar of leon24
leon24

ASKER

No my codes does not contain any SQL statements. I'm linking up my current database using stored procedures. I used the table adapter to do so. Does it mean that I have to embed all my codes from the stored procedures into the class files itself if I migrate my codes up to the server?
SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of leon24
leon24

ASKER

Hi all,

Thanks you all of your information. I've managed to get it working now!
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo