S
staeri
I'm trying to build an easy and generic report solution in my ASP.NET
2.0 application and I need suggestions how to do this.
I have a print button on my form which opens the generic print page
"Print.aspx?report=account". The report parameter tells which page
called the print page.
In the CodeFile "Print.aspx.vb" I have right now the following code
which needs to be generic:
Dim myDataSet As DataSet = New DataSet()
Dim myConnection As New SqlConnection("bla bla bla")
Dim mySqlDataAdapter As New SqlDataAdapter("SELECT * FROM
vwReport_account", myConnection)
mySqlDataAdapter.Fill(myDataSet, "ReportRows")
Dim myDataRow As DataRow
For Each myDataRow In myDataSet.Tables("ReportRows").Rows
Dim row As WorksheetRow = sheet.Table.Rows.Add
cell = row.Cells.Add
cell.Data.Text = myDataRow("Account").ToString()
cell = row.Cells.Add
cell.Data.Text = myDataRow("AccountDescription").ToString()
cell = row.Cells.Add
cell.Data.Text = myDataRow("Budget").ToString()
cell.StyleID = "s30"
cell.Data.Type = DataType.Number
Next
Can someone please help me with advice how to replace the code above
with a generic solution so that I don't have to separate code files for
each report?
Regards,
S
2.0 application and I need suggestions how to do this.
I have a print button on my form which opens the generic print page
"Print.aspx?report=account". The report parameter tells which page
called the print page.
In the CodeFile "Print.aspx.vb" I have right now the following code
which needs to be generic:
Dim myDataSet As DataSet = New DataSet()
Dim myConnection As New SqlConnection("bla bla bla")
Dim mySqlDataAdapter As New SqlDataAdapter("SELECT * FROM
vwReport_account", myConnection)
mySqlDataAdapter.Fill(myDataSet, "ReportRows")
Dim myDataRow As DataRow
For Each myDataRow In myDataSet.Tables("ReportRows").Rows
Dim row As WorksheetRow = sheet.Table.Rows.Add
cell = row.Cells.Add
cell.Data.Text = myDataRow("Account").ToString()
cell = row.Cells.Add
cell.Data.Text = myDataRow("AccountDescription").ToString()
cell = row.Cells.Add
cell.Data.Text = myDataRow("Budget").ToString()
cell.StyleID = "s30"
cell.Data.Type = DataType.Number
Next
Can someone please help me with advice how to replace the code above
with a generic solution so that I don't have to separate code files for
each report?
Regards,
S