The online community for software testing & quality assurance professionals
   
Active Topics Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Jobs
Training
News
Links
Downloads

News Group:
software.testing


Testing
Automation
Performance
Engineering
Miscellaneous
Statistics
Poll
  QA Forums
  SilkTest
  Writing data to excel spreadsheet ? (Page 1)

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone!
This topic is 3 pages long:   1  2  3 
next newest topic | next oldest topic
Author Topic:   Writing data to excel spreadsheet ?
Silk1997
unregistered
posted 11-07-2001 01:54 PM         Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997
Is anybody knows how to write data through 4Test script into Excel spread sheet ?

I have script, which reads data from excel spread sheet, (i.e. reading all names of column and all numbers of second column), BUT, Now after using this data, I would like to write it back to spread sheet. I think 4Test have the capability to write data (i.e. about 10-15 names in third coloumn)

Can 4Test write data to Excel spread sheet ?

Any responce will be appreciated.

------------------
California.
Silk1997@hotmail.com

IP Logged

dcreed
Moderator

Posts: 345
Registered: Jul 2001

posted 11-08-2001 08:33 AM     Click Here to See the Profile for dcreed   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by dcreed Visit dcreed's Homepage!
    There's a white paper about working with Excel that can be found here.

    - Dave

------------------
Amelior Technology
dreed@ameliortech.com

IP Logged

Silk1997
unregistered
posted 11-08-2001 10:12 AM         Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997
I used your given web site, last month, But It only shows how to read from excel spread sheet, NOT HOW TO WRITE INTO EXCEL SPREAD SHEET......,

Shafi.

------------------
California.
Silk1997@hotmail.com

IP Logged

dcreed
Moderator

Posts: 345
Registered: Jul 2001

posted 11-08-2001 10:48 AM     Click Here to See the Profile for dcreed   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by dcreed Visit dcreed's Homepage!
quote:
Originally posted by Silk1997:
I used your given web site, last month, But It only shows how to read from excel spread sheet, NOT HOW TO WRITE INTO EXCEL SPREAD SHEET......,


    Well, to write into the "table" in the spreadsheet you'd use an INSERT SQL statement.

    - Dave

------------------
Amelior Technology
dreed@ameliortech.com

IP Logged

Silk1997
unregistered
posted 11-08-2001 11:31 AM         Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997
It doesn't work, May be my sql statement is wrong, here is code....

[-] testcase GetInsertData () appstate none
[ ]
[ ] HANDLE hDB
[ ] HANDLE hSQL
[ ] INTEGER iAge
[ ] STRING sName
[ ]
[ ] //connect to the database
[ ] hDB = DB_Connect ("dsn=SilkTest_db")
[ ]
[ ] //Insert name=AAA into tablename 'Ages'
[ ] hSQL = DB_ExecuteSQL (hDB, "Insert into Ages Name Value AAA")
[ ]
[ ] //execute a SQL statement
[ ] hSQL = DB_ExecuteSQL (hDB, "SELECT Name, Age from Ages")
[ ]
[ ] //while there are still rows to retrive
[ ]
[-] while DB_FetchNext (hSQL, sName, iAge)
[-] if (sName == NULL)
[ ] break
[ ] print ("Name:{sName}; Age:{iAge}")
[ ]
[ ]
[ ]
[ ]
[ ]
[ ] DB_FinishSql (hSQL)
[ ]
[ ] //disconnect from thedatabase
[ ] DB_Disconnect (hDB)

------------------
California.
Silk1997@hotmail.com

IP Logged

zarehk
Member

Posts: 63
Registered: May 2001

posted 11-08-2001 01:13 PM     Click Here to See the Profile for zarehk   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by zarehk Visit zarehk's Homepage!
Try modifying the SQL to :

"Insert into `Ages$` Name Value 'AAA'"
"SELECT Name, Age from `Ages$`"

Note that the symbols around Ages are not regulat single quotes.

-Zareh

------------------
Amelior Technology
zarehk@ameliortech.com

IP Logged

GodKnows
Advanced Guru

Posts: 642
Registered: Jan 2001

posted 11-08-2001 01:13 PM     Click Here to See the Profile for GodKnows   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by GodKnows
SQL is a standard language to access different DBs(Oracle, DB2, Sybase, Informix, Microsoft SQL Server, Access, and others). Also each company have their own extentions to it for their own benefit.

Here is the link where you can learn how to use it. (http://www.w3schools.com/sql/default.asp)

this page about the insert-statement:
http://www.w3schools.com/sql/sql_insert.asp

------------------

IP Logged

Silk1997
unregistered
posted 11-08-2001 02:20 PM         Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997
It doesn't work, I tried everything...(Commented lines are what I tried one after another)

[-] testcase GetInsertData () appstate none
[ ]
[ ] HANDLE hDB
[ ] HANDLE hSQL
[ ] INTEGER iAge
[ ] STRING sName
[ ]
[ ] //connect to the database
[ ] hDB = DB_Connect ("dsn=SilkTest_db")
[ ]
[ ] //Insert name=AAA into table name 'Ages'

[ ] //hSQL = DB_ExecuteSQL (hDB, "Insert into 'Ages$' (Name, Age) Values('AAA', '22')")

[ ] //hSQL = DB_ExecuteSQL (hDB, "Insert into Ages (Name, Age) Values ('AAA', '22')")
[ ] hSQL = DB_ExecuteSQL (hDB, "INSERT into Ages Values ('AAA', '22')")

[ ]
[ ]
[ ]
[ ]
[ ]
[ ] //execute a SQL statement
[ ] hSQL = DB_ExecuteSQL (hDB, "SELECT Name, Age from Ages")
[ ]
[ ]
[ ] //while there are still rows to retrive
[ ]
[-] while DB_FetchNext (hSQL, sName, iAge)
[-] if (sName == NULL)
[ ] break
[ ] print ("Name:{sName}; Age:{iAge}")
[ ]
[ ]
[ ]
[ ]
[ ]
[ ] DB_FinishSql (hSQL)
[ ]
[ ] //disconnect from thedatabase
[ ] DB_Disconnect (hDB)

------------------
California.
Silk1997@hotmail.com

IP Logged

RobKapteyn
Guru

Posts: 355
Registered: Jun 2000

posted 11-08-2001 02:26 PM     Click Here to See the Profile for RobKapteyn   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by RobKapteyn Visit RobKapteyn's Homepage!
I think that you forgot to "name" a region in your Excel Workbook.
Read Dave Reed's excellent whitepaper AGAIN.

------------------
Rob Kapteyn

IP Logged

Silk1997
unregistered
posted 11-08-2001 02:57 PM         Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997
No, I named region in excel spread sheet. It's reading from excel properly, but writing into excel.

Shafi.

------------------
California.
Silk1997@hotmail.com

IP Logged

Silk1997@hotmail.com
Member

Posts: 50
Registered: Oct 2001

posted 11-08-2001 03:06 PM     Click Here to See the Profile for Silk1997@hotmail.com   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997@hotmail.com
It's reading data (Both the column data, Name and Age, about 2 rows) but nort inserting data into excel spread sheet. I simply would like to add one more row or overwrite it to the first row of data.

------------------
California.
Silk1997@hotmail.com

IP Logged

Silk1997@hotmail.com
Member

Posts: 50
Registered: Oct 2001

posted 11-08-2001 03:10 PM     Click Here to See the Profile for Silk1997@hotmail.com   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997@hotmail.com
I can email script to you directly, If you can provide your email address. It took me a week for this problem.

------------------
Any help will be appreciated, Thanking you.

Silk1997@hotmail.com

IP Logged

RobKapteyn
Guru

Posts: 355
Registered: Jun 2000

posted 11-08-2001 03:18 PM     Click Here to See the Profile for RobKapteyn   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by RobKapteyn Visit RobKapteyn's Homepage!
OK -- something else to try.
In the "ODBC Data Source" Control Panel.
Click "Configure" for your Microsoft Excel datasource.

Then at the bottom of the dialog click the button labeled "Options>>".
Uncheck the "Read Only" checkbox that is on by default.

Let us know if this does it.

------------------
Rob Kapteyn

IP Logged

Silk1997@hotmail.com
Member

Posts: 50
Registered: Oct 2001

posted 11-08-2001 03:41 PM     Click Here to See the Profile for Silk1997@hotmail.com   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997@hotmail.com
DOESN'T WORK.

I tried, with checked/unchecked 'Read only', Nothing happens....

[]*** Error: (HY000) [Microsoft][ODBC Excel Driver] Operation must use an updateable query.
[]Occurred in DB_ExecuteSql

------------------
Any help will be appreciated, Thanking you.

Silk1997@hotmail.com

IP Logged

Silk1997@hotmail.com
Member

Posts: 50
Registered: Oct 2001

posted 11-08-2001 04:45 PM     Click Here to See the Profile for Silk1997@hotmail.com   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Silk1997@hotmail.com

excelgetdata2.txt

 
Attachment, Unable to write (Insert/Update) data into script.

------------------
Any help will be appreciated, Thanking you.

Silk1997@hotmail.com

IP Logged


This topic is 3 pages long:   1  2  3 

All times are PT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A Reply
Hop to:

Contact Us | BetaSoft Inc. | Privacy Statement

Copyright İ 1997-2003 BetaSoft Inc.


Ultimate Bulletin Board 5.45c