runtime error in application
From: Bineesh Namboodiri (BineeshNamboodiri_at_discussions.microsoft.com)
Date: 10/27/04
- Next message: Bineesh Namboodiri: "runtime error in the application"
- Previous message: Bob O`Bob: "Re: IDE debug stops slow"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 27 Oct 2004 02:23:04 -0700
when iam running a process called convert(user-defined)in my application
which is to convert data from excel sheet to sql server table it's giving me
error that "runtime error 2147417851(800010105)
Automation error, server threws an exception". this error is coming only to
one process in my four process . all other are running fine . it's an
application which support data warehousing concepts . the database is
sqlserver 2000 & VB 6.0. This process is to convert data From EXcel file to
a table in sql server which is used for cube creation in further steps.[my
other process takes data from text file only & this process takes data from
excel file].Also this process is working from my source code . but when iam
trying it from exe file of the application it's giving me this error.
with this iam attaching a part of my source
Private Function ConvertInvestments(crtbrname)
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim objExcel As Excel.Application
Dim rstInvest As ADODB.Recordset
Dim writeStr() As Double
Set objExcel = New Excel.Application
Set oBook = objExcel.Workbooks.Open((APath & "\" & crtbrname &
"\Investment.xls"))
Set oSheet = oBook.Worksheets(1)
Set rstInvest = New ADODB.Recordset
Call InitRecset(rstInvest, "Truncate Table Investment")
Set rstInvest = Nothing
Call DeclareRec(rstInvest, "Select * from Investment")
preProduct = ""
preCurrency = ""
For lpVar = 2 To oSheet.Columns.CurrentRegion.Rows.Count
If Trim(preProduct) <> Trim(oSheet.Range("A" & lpVar).Value) Then
Call getHOProductCode(Trim(oSheet.Range("A" & lpVar).Value),
Trim(oSheet.Range("A" & lpVar).Value), Trim(oSheet.Range("E" & lpVar).Value))
If Trim(preCurrency) <> Trim(oSheet.Range("F" & lpVar).Value) Then
Call getCurrencyCode(Trim(oSheet.Range("F" & lpVar).Value))
If HOProductCode <> 0 Then
rstInvest.AddNew
rstInvest!ProductCode = HOProductCode
rstInvest!Description = Left(Trim(oSheet.Range("B" &
lpVar).Value), 30)
If Trim(oSheet.Range("D" & lpVar).Value) <> "" Then
rstInvest!InterestRate = oSheet.Range("D" & lpVar).Value * 100
Else
rstInvest!InterestRate = 0
End If
If IsDate(oSheet.Range("C" & lpVar).Value) = False Then
rstInvest!MaturityDate = "01/01/1900"
ElseIf CDate(oSheet.Range("C" & lpVar).Value) <
CDate("01/01/1900") Or CDate(oSheet.Range("C" & lpVar).Value) >
CDate("01/01/2079") Then
rstInvest!MaturityDate = "01/01/1900"
Else
rstInvest!MaturityDate = CDate(oSheet.Range("C" &
lpVar).Value)
End If
rstInvest!Amount = (oSheet.Range("E" & lpVar).Value)
rstInvest!CurrencyCode = CurrencyCode
rstInvest!CurrencyRate = (oSheet.Range("G" & lpVar).Value)
End If
Next lpVar
If Not rstInvest.EOF Then rstInvest.Update
oBook.Close
Set oBook = Nothing
Set oSheet = Nothing
objExcel.Quit
Set objExcel = Nothing
End Function
This part is called when going for conversion process which is also iam
attaching
If chkInvest.Value = vbChecked Then
If (fs.FileExists(APath & "\" & crtbrname & "\Investment.xls"))
Then
Call RefreshPrgBar("Investments", crtbrname)
Call ConvertInvestments(crtbrname)
End If
End If
It directly converts data in the XLS file to table called investment
- Next message: Bineesh Namboodiri: "runtime error in the application"
- Previous message: Bob O`Bob: "Re: IDE debug stops slow"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|