runtime error in my application
From: Bineesh Namboodiri (BineeshNamboodiri_at_discussions.microsoft.com)
Date: 10/27/04
- Next message: Giri K Subburaman: "Problem:Richtext box control"
- Previous message: Bineesh Namboodiri: "runtime error in the application"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 27 Oct 2004 02:33:03 -0700
when iam running a process called convert(user-defined)in my application
which is to convert data from excel *** 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.
here iam attaching my source code where this function is declared
Private Function ConvertInvestments(crtbrname)
Dim oBook As Excel.Workbook
Dim o*** As Excel.Work***
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 o***.Columns.CurrentRegion.Rows.Count
If Trim(preProduct) <> Trim(o***.Range("A" & lpVar).Value) Then
Call getHOProductCode(Trim(o***.Range("A" & lpVar).Value),
Trim(o***.Range("A" & lpVar).Value), Trim(o***.Range("E" & lpVar).Value))
If Trim(preCurrency) <> Trim(o***.Range("F" & lpVar).Value) Then
Call getCurrencyCode(Trim(o***.Range("F" & lpVar).Value))
If HOProductCode <> 0 Then
rstInvest.AddNew
rstInvest!ProductCode = HOProductCode
rstInvest!Description = Left(Trim(o***.Range("B" &
lpVar).Value), 30)
If Trim(o***.Range("D" & lpVar).Value) <> "" Then
rstInvest!InterestRate = o***.Range("D" & lpVar).Value * 100
Else
rstInvest!InterestRate = 0
End If
If IsDate(o***.Range("C" & lpVar).Value) = False Then
rstInvest!MaturityDate = "01/01/1900"
ElseIf CDate(o***.Range("C" & lpVar).Value) <
CDate("01/01/1900") Or CDate(o***.Range("C" & lpVar).Value) >
CDate("01/01/2079") Then
rstInvest!MaturityDate = "01/01/1900"
Else
rstInvest!MaturityDate = CDate(o***.Range("C" &
lpVar).Value)
End If
rstInvest!Amount = (o***.Range("E" & lpVar).Value)
rstInvest!CurrencyCode = CurrencyCode
rstInvest!CurrencyRate = (o***.Range("G" & lpVar).Value)
End If
Next lpVar
If Not rstInvest.EOF Then rstInvest.Update
oBook.Close
Set oBook = Nothing
Set o*** = Nothing
objExcel.Quit
Set objExcel = Nothing
End Function
this function is called in convert click button event & which looks like this
If chkInvest.Value = vbChecked Then
If (fs.FileExists(APath & "\" & crtbrname & "\Investment.xls"))
Then
Call RefreshPrgBar("Investments", crtbrname)
Call ConvertInvestments(crtbrname)
End If
End If
Here through conversion process we are transfering the data in XLS file to
table called investment
- Next message: Giri K Subburaman: "Problem:Richtext box control"
- Previous message: Bineesh Namboodiri: "runtime error in the application"
- Messages sorted by: [ date ] [ thread ]