Here is the script that establishing a connection to the Mysql database with ‘select statement’ Param( [Parameter( Mandatory = $true, ParameterSetName = ”, ValueFromPipeline = $true)] [string]$Query ) $ConnectionString=”This is your connection string” Try { [void][System.Reflection.Assembly]::LoadWithPartialName(“MySql.Data”) $Con = New-Object MySql.Data.MySqlClient.MySqlConnection $Con.ConnectionString = $ConnectionString $Con.Open() $MySqlCommand= New-Object MySql.Data.MySqlClient.MySqlCommand($Query, $Con) $DataAdapter = New-Object MySql.Data.MySqlClient.MySqlDataAdapter($MySqlCommand) $DataSet = New-Object […]
Posts Tagged: PowerShell
How to run .cs file with powershell
It is so easy. First, lets put our c# code into a powershell string. Here is the example. $exampleCode=@’using System; using System; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Windows.Media.Imaging; using System.Xml; public partial class Form1 : Form {
Testing a Website with Powershell
With powershell, you can easily browse a webpage with IE. You can click or edit HTML elements and run a test case. Let’s make an example of Facebook Login.