Avatar billede thomaxz Nybegynder
13. marts 2006 - 09:27 Der er 1 løsning

visual basic 6.0 + mysql

Jeg har hente driver http://dev.mysql.com/get/Downloads/MyODBC3/mysql-connector-odbc-3.51.12-win32.zip/from/pick#mirrors
Denmark [Cybercity Internet] HTTP (windos setup) som der står man skal gøre her -> http://www.eksperten.dk/spm/289099 men jeg kan stadig ikke få den kode her > http://www.access-programmers.co.uk/forums/showthread.php?t=97715 til at virke, og kan heller ikke finder nogle referen til Microsoft Ado men kun til ADOX som også var der før driver instaltion. og har også tilføje MyOdbs som der står man skulle her > http://dev.mysql.com/doc/refman/5.0/en/dsn-on-windows.html?ff=nopfpls

-Thomas
Avatar billede thomaxz Nybegynder
14. marts 2006 - 13:27 #1
Har løst mit problem

[kode]
Dim strDatabaseName As String
Dim strDBCursorType As String
Dim strDBLockType As String
Dim strDBOptions As String



Private Sub Command1_Click()
On Error GoTo Command1_Click_Error
Dim b As Long
'ikke nødvendig for funktion
'strDBCursorType = adOpenDynamic  'CursorType
'strDBLockType = adLockOptimistic  'LockType
'strDBOptions = adCmdText        'Options

Set cn = CreateObject("ADODB.Connection")
Me.MousePointer = 11

cn.Open ConnectString()
   
    With cn
        .CommandTimeout = 0
        '.CursorLocation = adUseClient 'anner ike hvad gjor godt for udkommenteret, virker
    End With

    Set Rs = CreateObject("ADODB.RecordSet")      'Creates record set

    strSQL = "SELECT * FROM type ORDER BY id ASC" 'min sql streng
   
    'rs.Open strSQL, cn, strDBCursorType, strDBLockType, strDBOptions
    'data der ikek var nødvendig frasorterede
    Rs.Open strSQL, cn

If Rs.EOF Then
  GoTo ExitSub
Else
    Do
        '<do whatever you need to do with the data here>
        List1.AddItem Rs("typenavn")
    Rs.MoveNext
    Loop While Not Rs.EOF
End If
   
ExitSub:

Rs.Close
Set Rs = Nothing
cn.Close
Set cn = Nothing

On Error GoTo 0
Exit Sub

Command1_Click_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Command1_Click of Form " & Me.Name
End Sub

Private Function ConnectString() As String
Dim strServerName As String
Dim strDatabaseName As String
Dim strUserName As String
Dim strPassword As String

    'Change to IP Address if not on local machine
    'Make sure that you give permission to log into the
    'server from this address
    'See Adding New User Accounts to MySQL
    'Make sure that you d/l and install the MySQL Connector/ODBC 3.51 Driver

strServerName = "127.0.0.1"
strDatabaseName = "thomas"
strUserName = "thomas"
strPassword = "web"

ConnectString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
                "SERVER=" & strServerName & _
                ";DATABASE=" & strDatabaseName & ";" & _
                "USER=" & strUserName & _
                ";PASSWORD=" & strPassword & _
                ";OPTION=3;"

End Function


[/kode]
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester