Today, doing one small task I thought: “Why can’t I do it with
PowerShell?”
So, here is a small example:
[void][system.reflection.Assembly]::LoadFrom("c:\devel\mysql\ps\MySQL.Data.dll")
$myconnection = New-Object MySql.Data.MySqlClient.MySqlConnection
$myconnection.ConnectionString = "server=localhost;user id=test;password=test;database=test;pooling=false"
$myconnection.Open()
$mycommand = New-Object MySql.Data.MySqlClient.MySqlCommand
$mycommand.Connection = $myconnection
$mycommand.CommandText = "SHOW TABLES"
$myreader = $mycommand.ExecuteReader()
while($myreader.Read()){ $myreader.GetString(0) }
--
c:\devel\mysql\ps\MySQL.Data.dll - that is a connector
PowerShell is a quiet new thing, so I believe it could be helpfull.