Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Connection to MySQL

Connection to MySQL

Scheduled Pinned Locked Moved C#
helpdatabasemysqlsysadmintutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    D i x y
    wrote on last edited by
    #1

    Hello Friends, I am developing an windows application in which i need to connect to MySQL Server through my application mean user enter the User Name and Password after that in a list box all the database of MySQL comes in Listbox. So my problem is how to connect to MySQL database through my application Please help me i am new in database.. Thanks

    N L S 3 Replies Last reply
    0
    • D D i x y

      Hello Friends, I am developing an windows application in which i need to connect to MySQL Server through my application mean user enter the User Name and Password after that in a list box all the database of MySQL comes in Listbox. So my problem is how to connect to MySQL database through my application Please help me i am new in database.. Thanks

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Download and use MySQLConnector .NET[^]

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      1 Reply Last reply
      0
      • D D i x y

        Hello Friends, I am developing an windows application in which i need to connect to MySQL Server through my application mean user enter the User Name and Password after that in a list box all the database of MySQL comes in Listbox. So my problem is how to connect to MySQL database through my application Please help me i am new in database.. Thanks

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You can use ADO.NET[^] to create a connection to the database and then query all databases using a SqlCommand. To connect to the database you need a valid connection string[^]. I'd recomment to use the MySQL .NET connector[^] to use for this task. regards

        D 1 Reply Last reply
        0
        • L Lost User

          You can use ADO.NET[^] to create a connection to the database and then query all databases using a SqlCommand. To connect to the database you need a valid connection string[^]. I'd recomment to use the MySQL .NET connector[^] to use for this task. regards

          D Offline
          D Offline
          D i x y
          wrote on last edited by
          #4

          Sir as you give me the link of connection string that is used to connect to MySQL server that's great but as i want to connect to like this user will enter Server Name, UserID and Password in the available textboxes and after that it will click on connect button that it should connect with all the available databases and shows them in Listbox Thanks

          L 1 Reply Last reply
          0
          • D D i x y

            Sir as you give me the link of connection string that is used to connect to MySQL server that's great but as i want to connect to like this user will enter Server Name, UserID and Password in the available textboxes and after that it will click on connect button that it should connect with all the available databases and shows them in Listbox Thanks

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I'm not sure if you can connect to the server without specifying a valid database. Maybe you should once connect to a database and then issue the SHOW DATABASES SQL command to get a list of the databases available to use for the next DB login from the listbox.

            1 Reply Last reply
            0
            • D D i x y

              Hello Friends, I am developing an windows application in which i need to connect to MySQL Server through my application mean user enter the User Name and Password after that in a list box all the database of MySQL comes in Listbox. So my problem is how to connect to MySQL database through my application Please help me i am new in database.. Thanks

              S Offline
              S Offline
              sacr83
              wrote on last edited by
              #6

              $user="UsernameForYourMySqlDB"; $pass="PasswordForYourMySqlDB"; $db="YourDB_Name"; $link=mysql_connect("localhost",$user,$pass); if(!$link) die("Couldnt connect to MySQL"); mysql_select_db($db,$link) or die ("couldnt open $db: ".mysql_error()); print "connected to $db";

              CheeN

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups