I never-ever use DataSets. ever I'd retrieve the data from the DB into an IEnumerable<SomeDto>, then feed it to the Json formatter.
On Wed, Jan 14, 2009 at 6:54 PM, Wayne Douglas <[email protected]>wrote: > OK - how does everyone manage executing a sproc to return the results as > json? > This must be a workflow used _everywhere_? > > w:// > > 2009/1/14 Colin Ramsay <[email protected]> > > >> That library isn't part of Castle, it's a separate project which >> Castle leverages. Try their homepage: >> >> http://www.codeplex.com/Json >> >> On Wed, Jan 14, 2009 at 4:36 PM, Wayne Douglas <[email protected]> >> wrote: >> > Hey All >> > (just posted this in the forum - thought it might not get picked up >> there so >> > reposted here - hope that's OK?) >> > This code throws an exception: >> > "Method may only be called on a Type for which Type.IsGenericParameter >> is >> > true." >> > [code] >> > [...] >> > SqlDataAdapter adapter = new SqlDataAdapter(command); >> > DataSet ds = new DataSet(); >> > adapter.Fill(ds, "BudgetMonitorSumReport"); >> > totalRecords = ds.Tables[0].Rows.Count; >> > try >> > { >> > message = "{\"total\": \"" + totalRecords + "\", >> > \"results\":" + new NewtonsoftJSONSerializer().Serialize(ds) + "}"; >> > >> > } >> > catch (Exception exc) >> > { >> > if (log.IsErrorEnabled) >> > { >> > log.Error("Failed converting data to JSON format", >> > exc); >> > } >> > } >> > RenderText(message); >> > [/code] >> > It's a standard dataset - i tried using just the datatable but that >> yields >> > the same results. >> > I just want to be able to send back the dataset as json. >> > >> > >> > w:// >> > > >> > >> >> >> > > > > -- Ken Egozi. http://www.kenegozi.com/blog http://www.delver.com http://www.musicglue.com http://www.castleproject.org http://www.gotfriends.co.il --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
