Hi,
My Question is so simple maybe but anyway i am stuck here
I want to run a sql query and write down the results in a table and email it to people
but i am in first phase now, i.e. getting sql query results
down the page u can see my code
and here is the result
Queue Total
Number Total Duration Status
----- ------------ -------------- ------
6377
0 0
idle_unanswered
6377
15 0
unanswered
6378
151 16969 answered
what i want is very simple
i just need to store any of this in an array
Array[1,1] = Queue Array[1,2] = Total Number ...
Array [2,1]=6377 Array[2,2]=0
.
.
.
but my methods did not work
thanks for ur help
the code is very simple
just connecting to a remote sql server and run the query
$SQLServer = "Networkdb.ourdomain.net"
## Selecting Appropriate Database
$SQLDBName = "GBG-CDR"
## Write Down The Query (Begin)
$SqlQuery = "Select * FROM [GBG-CDR].[dbo].[Foip - Yesterday Total Report] Where Queue = 6377 "
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
$MsgBody = $DataSet.Tables[0]
$MsgBody
Payne is back