steven lim

steven lim

  • NA
  • 2
  • 5.2k

HELP!how to generate a crystal report from gridview data???

Sep 20 2010 5:13 AM

Help!How to generate a crystal report from gridview data!
i ady can get data in gridview through the code below!
How can i generate a crystal report from this???
 

 
Dim sColList, sTableName As String
Dim DT_Data As New RS_UtilityService.dsSDFSystem.sp_DynamicSQLDataTable
Dim ds As New DataSet
Dim table1 As New DataTable


sTableName = ListColumn.DataSource(0)(
"TABLE_NAME").ToString
sColList =
"*"
If ListRptCol.ItemCount > 0 Then
Dim DT As DataTable = ListRptCol.DataSource
sColList =
""
For iCnt = 0 To DT.Rows.Count - 1
If DT(iCnt)("SOURCE").ToString = "CALC" Then
sColList +=
"|" & DT(iCnt)("COLUMN_NAME").ToString & "=(" & DT(iCnt)("FORMULA").ToString & ")"
Else
sColList +=
"|" & DT(iCnt)("COLUMN_NAME").ToString
End If
Next
sColList = Mid(sColList, 2)
End If


r_sSQL =
"Select Top(" & txtRecordNo.Text & ") " & sColList.Replace(CChar("|"), CChar(",")) & " From " & sTableName & _
" Where 0=0" & sParameter


If chkPreviewData.CheckState = CheckState.Unchecked Then r_sSQL += " And 1=0 "
Try
DT_Data = RiskkServices.UtilityService.GetDynamicData(r_sSQL)
Catch ex As Exception
RiskkCommonLib.RiskkMsg.ShowMsg(ex.Message,
"Error", MessageBoxButtons.OK, Utils.MessageBoxExLib.MessageBoxExIcon.Error)
End Try
grdReport.DataSource = DT_Data
grdV.RefreshData()
grdV.BestFitColumns()

Answers (1)