Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 461835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:00:52+00:00 2026-05-12T23:00:52+00:00

the underlying database on a project has changed from sql 2005 to MySql 5.1

  • 0

the underlying database on a project has changed from sql 2005 to MySql 5.1
The code has loads of method similar to below. I’m presuming it is just a case of switching the ‘con’ variable SqlConnection to a MYSql specific connection. Has anyone had any experience with this? I have never touched a mySql db. Any help much appreciated.

private SqlConnection con;

    public User LogonUser(string pUserName, string pPassword)
    {

        con = new SqlConnection();
        con.ConnectionString = DatabaseConstants.DB_CONN_STRING;


        using (con)
        {
            con.Open();
            var command = new SqlCommand();


            command.Connection = con;
            command.CommandText = "SELECT id FROM Users WHERE userName = @userName AND password = @password";
            command.CommandType = CommandType.Text;

            var userName = new SqlParameter("@userName", pUserName);
            var password = new SqlParameter("@password", pPassword);

            command.Parameters.Add(userName);
            command.Parameters.Add(password);


            User user;
            var dr = command.ExecuteReader();
            if (dr != null)

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        user = new User();
                        user.id = dr.GetString(0);
                        return user;
                    }
                }
                else
                {
                    throw new Exception("Can not find user, please check your username and password");
                }
        }
        return null;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:00:52+00:00Added an answer on May 12, 2026 at 11:00 pm

    Downloadable SQL Connectors are available for various frameworks and platforms – in this case assemblies to reference into your .NET project under the guise of ADO.NET are available from MySql. Can program against them using any .NET language.

    Start in C# by referencing the MySql namespace:

    using MySql.Data.MySqlClient; 
    

    and change over your ADO.NET class names from SqlConnection to MySqlConnection, etc. Google Code examples show cursory usage (similar to other ADO.NET providers), and of course the MySql docs are the best reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 517k
  • Answers 517k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Did you try to specify the path in your Derby… May 16, 2026 at 7:49 pm
  • Editorial Team
    Editorial Team added an answer You can declare one of the projects as a library… May 16, 2026 at 7:49 pm
  • Editorial Team
    Editorial Team added an answer The services are not returned in alphabetical order. You need… May 16, 2026 at 7:49 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm working on building a MySQL database and I'm thinking that rather than encode
Please excuse any mistakes in terminology. In particular, I am using relational database terms.
in our current project we are using ADO.NET Entity Framework as data layer for
In a previous project, I built an iPhone app for 2.2.x that used SQLite.
Background In my current project - a server product with no GUI front-end, I'm
Apparently, BDB-XML has been around since at least 2003 but I only recently stumbled
(Note: these two questions are similar, but more specific to ASP.Net) Consider a typical
I am using the SQLite database and have the following persistent class (simplified): public
I have created a SSAS project and it works perfectly fine my cubes, data-sources
Let's say I have a Cat that has two properties: FavoriteKitten SecondFavoriteKitten These kittens

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.