CSE 311 Lecture Notes - Lecture 1: Microsoft Visual Studio

25 views9 pages

Document Summary

Step 1: go to visual studio(2019)->click on create new project. >click on wcf service application->next->give name to your project->create. Step 2: project will get opened ->in solution explorer double click on. Code: add the below code in service1. svc. cs file. Service1. svc public class service1 : iservice1 public list getallemployees() var employeelist = new list(); Sqlcommand com = new sqlcommand("select id,name,salary from employee;", con); con. open(); Sqldatareader reader = com. executereader(); if (reader. hasrows) while (reader. read()) Employee obj = new employee(); obj. empid = reader. getint32(0); obj. name = reader. getstring(1); obj. salary = reader. getdouble(2); Step3:doble click on iservice1. cs and add the below code. [datacontract] public class employee string name; int empid; double salary; [datamember] public string name get { return name; } set { name = value; } [datamember] public int empid get { return empid; } set { empid = value; } [datamember] public double salary get { return salary; } set { salary = value; }

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents