I created a small web application with Microsoft WebMatrix. This web app has an attached SQL Server Compact database. I would like to use PowerShell to do some back end processing on the database but I can't figure out how to open a connection to the database!
Any help would be appreciated.
As a starter this is the code I use to connect to SQL Server
$connString = "server=server_name;Integrated Security=SSPI;database=database_name"$cn = new-object "System.Data.SqlClient.SqlConnection" $connString
# create the command$cmd = new-object "System.Data.SqlClient.SqlCommand"$cmd.CommandType = [System.Data.CommandType]"Text"$cmd.CommandText = "some sql goes here"$cmd.Connection = $cn
#get the data$dt = new-object "System.Data.DataTable"
$cn.Open()$rdr = $cmd.ExecuteReader()
$dt | Format-Table
if you need anything else please post back
Powered by IDERA