How to insert values to database from Selenium WebDriver by using variables

688 views
Skip to first unread message

Sri

unread,
Nov 17, 2015, 10:19:52 PM11/17/15
to Selenium Users
Hi,

could someone help me on this?

I am trying to use below code to insert values to database but i get the error as:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'Passed'.
No Customers found - Account # 55902933
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'Failed'. 

 val = "INSERT INTO Status (AccountNumber, Status) VALUES ( " + search.getAccountNumber() + "," + p + ")";
        stmt.executeUpdate(val);

 val1 = "INSERT INTO Status (AccountNumber, Status) VALUES ( " + search.getAccountNumber() + "," + f + ")";
        stmt.executeUpdate(val1);

in above code: p is Passed and f is Failed which i declared.
search.getAccountNumber() is i am reading value from spreadsheet and inserting to application.
I want to write same account number to database as status Passed or Failed depends on the application search results.

Could someone help me on this?

Thanks in Advance!

Krishnan Mahadevan

unread,
Nov 17, 2015, 10:24:57 PM11/17/15
to Selenium Users
SriLatha,

Where is Selenium involved here ? You are just using plain java code to insert records into database. This has got nothing to do with Selenium/WebDriver. I would suggest that you post this query on some other relevant forum such as StackOverflow ]

Please help keep this forum relevant by posting queries that are only related to Selenium/WebDriver.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/55eaae5f-9825-4771-bdd8-ee993bdb478e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages