You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS 2010 development solution (ALL C# projects) 3 tier solutions (App/Model/BLL/DLL)
a. database is SQL 2010
currently using Custom DAL and in process of testing PetaPoco for replacement.
includes report module (rdls reports) created/displayed from C# report viewer
a. all reports are generic and rely on DataTables currently returned from Stored Procedures calls only
b. data is collected and processed with in stored procedure(s) no physical reporting tables exists.
here is my issue:
I have an existing project that I am trying to convert to PetaPoco DAL instead of my custom coded DAL.
I have added all files and references and for most of my testing PP is working (I have not done a full fledge implementation as there is a lot of strange dependent code for existing DAL but eventually PP will replace all my needs for DB access)
I understand how most of the thing work with PetaPoco when using the POCOs from datatables (I have included the T4 template that generates all POCOs from database.)
But I have a reporting project that does not use any tables directly. All of the application currently use Stored Procedures for All data access and manipulations, and the reporting module rely only on Stored procedures for data.
no POCOs exists.
Now I can call the SP like so (I have tried all methods I could think of so far)
"new Database(Config.MainDbConnectionName).ExecuteProc("MetalCostByMonthReport",
new
{
@ReportDate = CurrentReportDate,
@TargetMetal = targetMetal,
@MetalPrice =
Helper.GetValidatedValue
(userInput.Text),
@GenerateInvoice = regenerate
}).
Rows);"
which returns an ExpandoObject but I can not use it.
my grid wont bind to it directly and when I try to convert the result into DataTabel (which what the underlying code expects back for binding to datagridview)
using this code found on one of the forums
///
/// Extension method to convert dynamic data to a DataTable. Useful for databinding.
/// </summary>
/// <param name="items"></param>
/// <returns>A DataTable with the copied dynamic data.</returns>
public static DataTable DynamicToDataTable( IEnumerable<dynamic> items)
{
if (items.ToArray().Count() == 0) return null;
var dt = new DataTable();
dt.Columns.AddRange(((IDictionary<string, object>)items.FirstOrDefault()).Keys.Select(k => new DataColumn(k)).ToArray());
foreach (var record in items)
{
dt.Rows.Add(((IDictionary<string, object>) record).Values.ToArray());
}
dt.EndLoadData();
return dt;
}
I get an error in the report as if data is bad.
I have verified that the data is GOOD (the proc is called using the old DAL and returns the same data)
I can see the data in the dataTable as well.
but report cuts out approximately half way through and nothing.
here are the questions I have:
is there a better way in calling the SP with PP
can I use PP without predefined POCOs
Any at all sugestions what am I doing wrong
Thanks
The text was updated successfully, but these errors were encountered:
I'm sorry that your issue has been left for so long. In an effort to reboot PetaPoco your issue has been closed. If you think this is still a problem. Please feel free to open and another issue. Please pass the word on that PetaPoco is back. We're looking for people #204.
Hi, All good people on this site.
a little help would be greatly appreciated :-)
SETUP:
a. database is SQL 2010
a. all reports are generic and rely on DataTables currently returned from Stored Procedures calls only
b. data is collected and processed with in stored procedure(s) no physical reporting tables exists.
here is my issue:
I have an existing project that I am trying to convert to PetaPoco DAL instead of my custom coded DAL.
I have added all files and references and for most of my testing PP is working (I have not done a full fledge implementation as there is a lot of strange dependent code for existing DAL but eventually PP will replace all my needs for DB access)
I understand how most of the thing work with PetaPoco when using the POCOs from datatables (I have included the T4 template that generates all POCOs from database.)
But I have a reporting project that does not use any tables directly. All of the application currently use Stored Procedures for All data access and manipulations, and the reporting module rely only on Stored procedures for data.
no POCOs exists.
Now I can call the SP like so (I have tried all methods I could think of so far)
"new Database(Config.MainDbConnectionName).ExecuteProc("MetalCostByMonthReport",
new
{
@ReportDate = CurrentReportDate,
@TargetMetal = targetMetal,
@MetalPrice =
Helper.GetValidatedValue
(userInput.Text),
@GenerateInvoice = regenerate
}).
Rows);"
which returns an ExpandoObject but I can not use it.
my grid wont bind to it directly and when I try to convert the result into DataTabel (which what the underlying code expects back for binding to datagridview)
using this code found on one of the forums
///
I get an error in the report as if data is bad.
I have verified that the data is GOOD (the proc is called using the old DAL and returns the same data)
I can see the data in the dataTable as well.
but report cuts out approximately half way through and nothing.
here are the questions I have:
Thanks
The text was updated successfully, but these errors were encountered: