I have created silktest script to read data from Excel sheet. When I run the code I am getting the following error message. Excel sheet is in place.
[ ] *** Error: (42S02) [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object 'Book1'. Make sure the object exists and that you spell its name and the path name correctly.
[ ] Occurred in DB_ExecuteSql
[ ] Called from Readexcel at sample.t(15)
Code I am using:
[-] type excelread is record
[ ] INTEGER EMPNO
[ ] STRING EMPNAME
[ ] INTEGER SALARY
[ ] excelread ex1
[-] testcase Readexcel( ) appstate none
[ ] HDATABASE hdbc
[ ] HSQL hstmnt
[ ] STRING sDataSource = "C:\Documents and Settings\Swathi\Desktop\Book1.xls"
[ ] //hdbc = DB_Connect("DSN=Silk DDA Excel;DBQ=C:\Documents and Settings\Swathi\Desktop\Book1.xls;UID=;PWD=;")
[ ] //hdbc = DB_Connect("DSN= Excel Files;DBQ=C:\Documents and Settings\Swathi\Desktop\Book1.xls;UID=;PWD=;")
hstmnt = DB_ExecuteSQL (hdbc, "SELECT * FROM `Sheet1$`")
Although this shud work as well - hstmnt = DB_ExecuteSQL (hdbc, "Select * from [Sheet1$]")
Make sure that the sheet name in your Book1.xls is Sheet1
Also, make sure your excel file is named as "Book1.xls" & not "Book1.xls.xls" Some times if the file extensions are hidden then we dont realize how the file is actually named ... it might not be the case with u but its better to be sure [img]/images/graemlins/smile.gif[/img]