Dim sColList, sTableName As StringDim DT_Data As New RS_UtilityService.dsSDFSystem.sp_DynamicSQLDataTableDim ds As New DataSetDim table1 As New DataTablesTableName = ListColumn.DataSource(0)("TABLE_NAME").ToStringsColList = "*"If ListRptCol.ItemCount > 0 ThenDim DT As DataTable = ListRptCol.DataSourcesColList = ""For iCnt = 0 To DT.Rows.Count - 1If DT(iCnt)("SOURCE").ToString = "CALC" ThensColList += "|" & DT(iCnt)("COLUMN_NAME").ToString & "=(" & DT(iCnt)("FORMULA").ToString & ")"ElsesColList += "|" & DT(iCnt)("COLUMN_NAME").ToStringEnd IfNextsColList = Mid(sColList, 2)End Ifr_sSQL = "Select Top(" & txtRecordNo.Text & ") " & sColList.Replace(CChar("|"), CChar(",")) & " From " & sTableName & _" Where 0=0" & sParameterIf chkPreviewData.CheckState = CheckState.Unchecked Then r_sSQL += " And 1=0 "TryDT_Data = RiskkServices.UtilityService.GetDynamicData(r_sSQL)Catch ex As ExceptionRiskkCommonLib.RiskkMsg.ShowMsg(ex.Message, "Error", MessageBoxButtons.OK, Utils.MessageBoxExLib.MessageBoxExIcon.Error)End TrygrdReport.DataSource = DT_DatagrdV.RefreshData()grdV.BestFitColumns()