born2program
Technical User
I am trying to export data from a dataset in some vb script behind my asp page. When I run the code I get an error that says "Specified Cast Not Valid". This is the code I have so far. Didn't know whether to post this in the vb forum or the asp. Any help is appreciated. Thanks.
Private Sub btnExportXLS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExportXLS.Click
Dim oExcel As Excel.Application
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim iRow As Integer
Dim iCol As Integer
Dim a As Integer
Dim Folder As String
Dim TopCellAddr As String
Dim ColumnLetter As String
Dim objDataHandler As New DataHandler
Dim objDeptDataSet As New DataSet
Dim objDeptDataView As New DataView
Dim dt As DataTable
Dim dr As DataRow
objDeptDataSet = objDataHandler.getChecksToBePrinted
objDeptDataView = objDeptDataSet.Tables.Item(0).DefaultView
oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
End Sub
Private Sub btnExportXLS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExportXLS.Click
Dim oExcel As Excel.Application
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim iRow As Integer
Dim iCol As Integer
Dim a As Integer
Dim Folder As String
Dim TopCellAddr As String
Dim ColumnLetter As String
Dim objDataHandler As New DataHandler
Dim objDeptDataSet As New DataSet
Dim objDeptDataView As New DataView
Dim dt As DataTable
Dim dr As DataRow
objDeptDataSet = objDataHandler.getChecksToBePrinted
objDeptDataView = objDeptDataSet.Tables.Item(0).DefaultView
oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
End Sub