Create a new web site with the name WCF traction client à Design the page à add references 3 WCF services created early in this program
Transactions” Namespace write the following code using system data sqlclient; using system Transactions; using SRC; using SRM; using SRT; sqlconnection con= new sqlconnection (“---“) ; protected void btnsubmit_click(----) {
Con.close(); s= “select cbalance from merchant where MID = ‘ “cmd = new sql command (s, con); con opend(); Dr = cmd. Execute reader(); DR. Read (); double M Bal = convert. Tobouble (DR[0]); MBal = MBal + convert . to double (txt Tamt.text); con.close(); if (<bal<0) lbl display text ‘balance is not sufficient, transaction cannot be performed”; else { using (transaction scope TS = new transaction scope option. Required) { try { customer client objc = new customer clinet (); Merchant client objM = new merchant client (); Transaction client objT = new Transaction client (); objc update customer (txtcId. Text, cbal); objM. Insert transaction ((txt Tid – text, text Cid. Text, txt Mid. Text, datatime. Now .date, convert. To bouble / txt tamt. Text), cbal, mbal); T.S.complete(); lbldisplay.text = “Transaction successful”; } catch { TS dispose (); lbldisplay.text =”Transaction Rooled back”; } } }
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.