How to read .xls file contents without using the ddt wizard?
Submitted by: AdministratorHow to read .xls file contents without using the ddt wizard? [the result file is result.res Parsed it to result.rex file such that I can read this file The test case file is testcase.xls
Now I need to search the contents of that file and next to the cell I need to update the result of the rex file
I succeeded to read a .rex file
Now I need to know is there any simple way to read the xls file and need to update this file
I tried with one approach and further i strucked
[ ] STRING gsDSNConnect = "DSN=Segue DDA Excel;DBQ=C:abcdef.xls;UID=;PWD="
[ ] HDATABASE DBHandle
[ ] HSQL SQLHandle
[ ] DBHandle=DB_Connect(gsDSNConnect)
[ ]
[ ] SQLHandle=DB_ExecuteSql(DBHandle,"select ")
From here on wards I didn't got the idea how to read the contents of .xls file)
[-] List of anytype ReadingDataFromXLS(string sFileName,inout anytype aRecordName, string sQuery optional)
[ ]
[ ] List of anytype lrRecordData
[ ]
[ ] HDATABASE hdbc
[ ] HSQL hstmnt
[ ]
[ ] string sFilePath = "{sFileName}.xls"
[-] do
[ ]
[-] if (!SYS_FileExists(sFilePath))
[ ] Log.Write("File does not exists in specified path i.e {sFilePath}, Please check the existance of the file.","ERROR")
[-] else
[ ]
[ ] // connect to xls file
[ ] hdbc = DB_Connect ("DSN=Segue DDA Excel;DBQ={sFilePath}")
[ ]
[-] if (sQuery != NULL)
[ ] // retrieve info from Excel worksheet
[ ] hstmnt = DB_ExecuteSql (hdbc, sQuery)
[-] else
[ ] // retrieve info from Excel worksheet
[ ] hstmnt = DB_ExecuteSql (hdbc, "SELECT * FROM `Sheet1$`")
[ ]
[ ] //Loop through excel file for retriving the data
[-] while (DB_FetchNext (hstmnt, aRecordName))
[ ] ListAppend(lrRecordData,aRecordName)
[ ]
[ ] //release SQL stmt resources
[ ] DB_FinishSQL (hstmnt)
[ ]
[ ] // Disconnect
[ ] DB_Disconnect (hdbc)
[ ]
[ ] //return the excel data in record structure
[ ] return lrRecordData
[ ]
[-] except
[ ] Log.Write("There may be problem in reading the excel file.. Please close all opened Excel files","ERROR")
Submitted by: Administrator
Now I need to search the contents of that file and next to the cell I need to update the result of the rex file
I succeeded to read a .rex file
Now I need to know is there any simple way to read the xls file and need to update this file
I tried with one approach and further i strucked
[ ] STRING gsDSNConnect = "DSN=Segue DDA Excel;DBQ=C:abcdef.xls;UID=;PWD="
[ ] HDATABASE DBHandle
[ ] HSQL SQLHandle
[ ] DBHandle=DB_Connect(gsDSNConnect)
[ ]
[ ] SQLHandle=DB_ExecuteSql(DBHandle,"select ")
From here on wards I didn't got the idea how to read the contents of .xls file)
[-] List of anytype ReadingDataFromXLS(string sFileName,inout anytype aRecordName, string sQuery optional)
[ ]
[ ] List of anytype lrRecordData
[ ]
[ ] HDATABASE hdbc
[ ] HSQL hstmnt
[ ]
[ ] string sFilePath = "{sFileName}.xls"
[-] do
[ ]
[-] if (!SYS_FileExists(sFilePath))
[ ] Log.Write("File does not exists in specified path i.e {sFilePath}, Please check the existance of the file.","ERROR")
[-] else
[ ]
[ ] // connect to xls file
[ ] hdbc = DB_Connect ("DSN=Segue DDA Excel;DBQ={sFilePath}")
[ ]
[-] if (sQuery != NULL)
[ ] // retrieve info from Excel worksheet
[ ] hstmnt = DB_ExecuteSql (hdbc, sQuery)
[-] else
[ ] // retrieve info from Excel worksheet
[ ] hstmnt = DB_ExecuteSql (hdbc, "SELECT * FROM `Sheet1$`")
[ ]
[ ] //Loop through excel file for retriving the data
[-] while (DB_FetchNext (hstmnt, aRecordName))
[ ] ListAppend(lrRecordData,aRecordName)
[ ]
[ ] //release SQL stmt resources
[ ] DB_FinishSQL (hstmnt)
[ ]
[ ] // Disconnect
[ ] DB_Disconnect (hdbc)
[ ]
[ ] //return the excel data in record structure
[ ] return lrRecordData
[ ]
[-] except
[ ] Log.Write("There may be problem in reading the excel file.. Please close all opened Excel files","ERROR")
Submitted by: Administrator
Read Online SilkTest Job Interview Questions And Answers
Top SilkTest Questions
☺ | How to search for html link? |
☺ | How to read .xls file contents without using the ddt wizard? |
☺ | Need help regd. silk test runing thr .bat file on cmd prompt? |
☺ | How to launch 2 web application windows simultaneously thru Silktest? |
☺ | Can SilkTest run on Mac? |
Top Application Program Categories
☺ | AutoCAD Interview Questions. |
☺ | Microsoft Office Interview Questions. |
☺ | Microsoft Outlook Interview Questions. |
☺ | Microsoft Excel Interview Questions. |
☺ | MATLAB Interview Questions. |