1

I am interested in developing web applications in ASP.NET using MySQL, is this something difficult to do/does it easily integrate with Visual Studio 2010? I really like using the .NET platform for web applications but I would prefer to use MySQL over Microsoft SQL Server. Can somebody shed some light/direct me to good links?

Sorry if this is a ridiculous question, I'm new to web applications and the .NET framework.

2
  • Where can you find information about setting up an ASP.NET web application with MySql? Seriously? Have you tried Google? :) Commented Jun 29, 2011 at 0:52
  • It's not much different than any other database. Just use a different data provider. Commented Jun 29, 2011 at 2:19

2 Answers 2

4

Try some of these links to start

Using MySQL with ASP.NET

Connect to MySQL database from ASP.NET

Using MySQL with ASP.NET

EDIT : Looks like you will have to use an ODBC connection. You'll need to set up an ODBC connection on your PC and wherever you deploy the app. This is an example that I've used when connecting to an Informix database, which used an ODBC connection. You'll need to install the drivers for MySql first.

Web.config connection string for an Informix database

<add name="odbcConnection" connectionString="Driver={IBM INFORMIX 3.82 32 BIT};uid=odbcUsername;pwd=odbcPassword;database=odbcDatabase; host=odbcHostName;srvr=odbcServerName;serv=odbcServ;pro=onsoctcp;cloc=en_US.819;dloc=en_US.819;vmb=0;condb=1;xcl=0;curb=0;scur=0;icur=0;oac=1;optofc=0;rkc=0;odtyp=0;fbs=4096;ddfp=0;dnl=0;rcwc=0" providerName="System.Data.Odbc"/>

DataAccess method

Dim cnStr As String = ConfigurationManager.ConnectionStrings("odbcConnection").ToString

Public Function GetTable() As Data.DataSet
    Dim ds As New Data.DataSet
    Dim sql As String = ""

        Using myConnection As OdbcConnection = New OdbcConnection(cnStr)
            Dim myCommand As New OdbcCommand()
            Dim oda As OdbcDataAdapter = New OdbcDataAdapter()
                sql = "SELECT * FROM table"

                If myConnection.State = ConnectionState.Closed Then
                    myConnection.Open()
                    myCommand = New OdbcCommand(sql, myConnection)
                    myCommand.CommandType = CommandType.Text
                    oda.SelectCommand = myCommand
                    oda.Fill(ds, "tblInfo")
                End If
        End Using
    Return ds
End Function
Sign up to request clarification or add additional context in comments.

Comments

0

You can Add Mysql.Data Nuget Package to your project and then just change the connection string for mysql server and it will work for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.