Results 1 to 5 of 5

Thread: RESOLVED First Time I use MYSQL

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2004

    Resolved RESOLVED First Time I use MYSQL

    Hello all and thanks for taking the time

    If some one can direct me to some docs that will show me

    1. How to connect to mysql db with a webpage
    2. How to connect to mysql db with vb6

    A little background i have been playing with access db for a while now and im quite comfortable with them. But if i want to put my db on a web server unless the webserver supports MSaccess i have to use mysql (As far as i have found out through the search option on this site)

    I have tried using the MySQL manual and certain online tutorials through google but they just seem to show you how to use mysql through the console.

    I m ussually pretty good at this thing but for some reason i m soooo lost
    if anyone can please help it will muchly appreciated.


    ps. Hope this makes sense
    Last edited by wolve; Aug 12th, 2005 at 09:43 PM. Reason: resolved
    I'm not a pain in the ass, Im just making things intresting......

  2. #2
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    my n00k.

    Re: First Time I use MYSQL

    what scripting language will u be using? and what web server?

    VisualAd has a very nice tutorial on connecting everything when u are using PHP, Apache, MySQL.

    as for connecting to vb6.. you need an odbc driver of MySQL for that.

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005

    Re: First Time I use MYSQL

    Take a look at

    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003

    Re: First Time I use MYSQL

    Here is what I use to connect to MySql:

    VB Code:
    1. Option Explicit
    2. Private strDataBaseName As String
    3. Private strDBCursorType As String
    4. Private strDBLockType As String
    5. Private strDBOptions As String
    6. Private strSQL as String
    7. Private rs As ADODB.Recordset
    8. Private cn As ADODB.Connection
    10. Private Sub Command1_Click()
    11. On Error GoTo Command1_Click_Error
    12. Dim b as Long
    13. strDBCursorType = adOpenDynamic  'CursorType
    14. strDBLockType = adLockOptimistic   'LockType
    15. strDBOptions = adCmdText         'Options
    17. Set cn = New ADODB.Connection
    18. Me.MousePointer = 11
    20. cn.Open ConnectString()
    22.     With cn
    23.         .CommandTimeout = 0
    24.         .CursorLocation = adUseClient
    25.     End With
    27.     Set rs = New ADODB.Recordset       'Creates record set
    29.     strSQL = "<Your SQL Here>"
    31.     rs.Open strSQL, cn, strDBCursorType, strDBLockType, strDBOptions
    34. if rs.Eof then
    35.    Goto ExitSub    
    36. else
    37.     For b = 1 To rs.RecordCount
    38.     '<do whatever you need to do with the data here>
    39.     Next b
    40. end if
    42. ExitSub:
    44. rs.Close
    45. Set rs = Nothing
    46. cn.Close
    47. Set cn = Nothing
    49. On Error GoTo 0
    50. Exit Sub
    52. Command1_Click_Error:
    53.     MsgBox "Error " & Err.Number & " (" & Err.Description & ")  & _
    54.                      in procedure Command1_Click of Form " & Me.Name
    55. End Sub
    57. Private Function ConnectString() As String
    58. Dim strServerName as String
    59. Dim strDatabaseName as string
    60. Dim strUserName as string
    61. Dim strPassword as string
    63.     'Change to IP Address if not on local machine
    64.     'Make sure that you give permission to log into the
    65.     'server from this address
    66.     'See [URL=]Adding New User Accounts to MySQL[/URL]
    67.     'Make sure that you d/l and install the [URL=]MySQL Connector/ODBC 3.51 Driver[/URL] or the
    68.     '[URL=]MySQL Connector/ODBC 5.0 Driver[/URL]
    70. strServerName = "localhost"
    71. strDatabaseName = "DatabaseName"
    72. strUserName = "UserName"
    73. strPassword ="Password"
    75. ConnectString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
    76.                 "SERVER=" & strServerName & _
    77.                 ";DATABASE=" & strDatabaseName & ";" & _
    78.                 "USER=" & strUserName & _
    79.                 ";PASSWORD=" & strPassword  & _
    80.                 ";OPTION=3;"
    82. End Function
    Last edited by Mark Gambo; Dec 3rd, 2006 at 04:09 PM.


    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2004

    Re: First Time I use MYSQL

    Thank you for all the replies, the outcome? it can now be done
    Once again thanks for a your replies, it works perfect now
    I'm not a pain in the ass, Im just making things intresting......

Posting Permissions

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

Click Here to Expand Forum to Full Width