I've been trying to figure out how to access data from my Silverlight application for a few days, now.
I want to use a data class and a business class already written.
Based on some advice from another post I created a Silverlight Business application. The Code to access the data is in a Domain Service class in my Web Application. This is called from the Silveright application.
I think I'm close but I don't have the syntax quite right.
Here is the code in my Domain Service Class
Public Function GetGridData() As IEnumerable(Of Submissions)
Dim dtResults As DataTable
Dim _ConnectionString As String
= _
"Password=xxxx;Persist Security Info=True;User ID=xxxx;Initial Catalog=APCD;Data Source=xxxx"
mdsResults = s.GetSubmissions(3, 0, _ConnectionString,"2011", "0", False)
dtResults = mdsResults.Tables(0)
Dim MySubmissions = New List(Of Submissions
)()
For Each row As DataRow In
dtResults.Rows
Dim MySubmission = New Submissions() With
{ _
.SubmissionControlId = Convert.ToString(row("SubmissionControlId"
)), _
.OrgId = Convert.ToString(row("Org Id"
)), _
.DateProcessed = Convert.ToString(row("DateProcessed")) _
}
MySubmissions.Add(MySubmission)
Next
Return MySubmissions
End Function
The code in the silverlght page is
Dim x As New Web.CustomerDomainContext
grdSubmissions.DataContext = x.GetGridData()
It all compiled and runs but the grid is empty. I know from stepping through that Stored Procedure does contain data.