Results 1 to 6 of 6

Thread: MySQL - for the 1000th time!

Hybrid View

  1. #1
    Hyperactive Member
    Join Date
    Dec 02
    Location
    Canton, GA
    Posts
    487

    MySQL - for the 1000th time!

    Hello all... I know this is a question that has been asked thousands of times.... I appologize...

    I have finally made up my mind that I am going to focus on asp.net vs php...

    I gave up hope about 4 months ago on asp.net when I could not conquer this question... I am quite sure it has come a long way since then...

    I am self taught, reading books etc etc... so I am looking for a through way that will show me how to connect to a mysql database using asp.net... this is a project I have decided I am going to learn today!

    I have seen some examples on the net but it gets very confusing very quick...

    would someone be kind enough to show me / tell me what I need to do...

    here would be an example...

    MySQl database = mydata
    User Name = name
    password = password
    Table = customers
    field = customer name

    can someone tell me using asp.net how to connect to the database (Localhost use is fine - I have a dedicated server)

    then display the customer name field?

    this may be simple to some.. but if I can atleast get the connection started I can figure out the other 95% from there...

    If I have read correctly MYSQL has released an OBDC connection that can be used now... or am I incorrect in this assumption?

    Thanks in advance!!

    Anjari

  2. #2
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    What you need is ADO.NET:

    http://samples.gotdotnet.com/quickst...sOverview.aspx

    Here's a very simple example of using a DataReader:

    VB Code:
    1. strConn = "Initial Catalog = pubs; Data Source = IN-DEV-RAJAT; User ID = sa; password = ;"
    2.         strSQL = "SELECT * FROM authors;"
    3.  
    4.         sqlConn.ConnectionString = strConn
    5.         sqlCommand.Connection = sqlConn
    6.         sqlCommand.CommandText = strSQL
    7.         sqlCommand.Connection.Open()
    8.  
    9.         dr = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection)
    10.  
    11.         With dr
    12.             Do While .Read = True
    13.                 strResult = .GetString(1) & " " & .GetString(2)
    14.                 Console.WriteLine(strResult)
    15.             Loop
    16.  
    17.             .Close()
    18.  
    19.         End With

    You will get your connection string here:

    http://www.able-consulting.com/dotne...ETDataProvider



    You can get drivers from this URL:

    http://crlab.com/mysqlnet/download.html

  3. #3
    Banned jhermiz's Avatar
    Join Date
    Jun 02
    Location
    Antarctica
    Posts
    2,492
    hahahahahahahaha

    user name sa and no password

    thats a big no no hahahahahahahahahahahaha


  4. #4
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    Yeah, I'd leave the password here for all to see.

  5. #5
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 02
    Location
    The mystic land of Geordies
    Posts
    992
    If your using MySQL thne you can't use the sql namespace.
    The OLEDb wont work either, or at least it didn't when I last tried.

    You need to download the ODBC Namespace from either the MySQL site or Microsoft.

    Parksie

  6. #6
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 02
    Location
    The mystic land of Geordies
    Posts
    992

    Parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •