Mysql-Connection

How can I create a mysql connection with my server. Maybe, can someone write a tutorial? :smiley:

Thank you :slight_smile:

@Apple said in Mysql-Connection:

How can I create a mysql connection with my server. Maybe, can someone write a tutorial? :smiley:

Thank you :slight_smile:

You should be able to use any LUA based MySQL connection.

local reflection = clr.System.Reflection
local assembly = reflection.Assembly.LoadFrom('resources/database/lib/MySql.Data.dll')
local mysql = clr.MySql.Data.MySqlClient
local client = mysql.MySqlConnection("server=localhost;database=test;userid=root;password=")

client.Open()

local cmd = mysql.MySqlCommand("SELECT VERSION()", client)
print("MySQL Version:")
print(cmd.ExecuteScalar())

client.Close()

I tried use this code, and it’s work. But how can I use ExecuteReader in LUA for get array of data.

1 Like