Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Connect Excel to My SQL in VBA

walo

 
 
The Saint
Prime Member
Advanced Member
Messages
877
Reaction score
4,726
Points
328
Space Stone
Mind Stone
Power Stone
Reality Stone
Soul Stone
Time Stone
Private Sub UserForm_Initialize()
Dim connStr As String
Dim conn As Object

Set conn = New ADODB.connection

' Set connection parameters
Dim dsnName As String
Dim server As String
Dim port As Integer
Dim database As String
Dim username As String
Dim password As String


dsnName = "MySql"
server = "127.0.0.1"
port = 3306 ' Replace with your actual port number
database = "dbwalo"
username = "admin"
password = "SirWalo88"


connStr = "DSN=" & dsnName & ";SERVER=" & server & ";PORT=" & port & ";DATABASE=" & database & ";UID=" & username & ";PWD=" & password

On Error GoTo ErrorHandler

conn.Open connStr
MsgBox "Connection successful"

Exit Sub

ErrorHandler:
MsgBox "Error connecting to database: " & Err.Description
conn.Close
End Sub

Installer Needed:

mysql-connector-odbc-8.0.32-win32.msi
xampp-win32-7.3.0-0-VC15-installer.exe


ALWAYS CLICK LIKE!!!
 

Attachments

  • 23.jpg
    23.jpg
    57.2 KB · Views: 25
  • Untitled.jpg
    Untitled.jpg
    64.7 KB · Views: 25
  • 36.jpg
    36.jpg
    70.9 KB · Views: 25
Back
Top Bottom