Thursday, December 19, 2013

Create a Stored Procedure in SQL Server

This topic describes how to create a stored procedure by using SQL Server. 

 Create one table :-

CREATE TABLE  tbl_Students

(
    [Studentid] [int] IDENTITY(1,1) NOT NULL,
    [Firstname] [nvarchar](200) NOT  NULL,
    [Lastname] [nvarchar](200)  NULL,
    [Email] [nvarchar](100)  NULL
)
 
 
Support we insert the following data into the above table:-
 
Insert into tbl_Students (Firstname, lastname, Email)
 Values('Vivek', 'Johari', 'vivek@abc.com')

Insert into tbl_Students (Firstname, lastname, Email)
 Values('Pankaj', 'Kumar', 'pankaj@abc.com')

Insert into tbl_Students (Firstname, lastname, Email)
 Values('Amit', 'Singh', 'amit@abc.com')

Insert into tbl_Students (Firstname, lastname, Email)
 Values('Manish', 'Kumar', 'manish@abc.comm')

Insert into tbl_Students (Firstname, lastname, Email)
 Values('Abhishek', 'Singh', 'abhishek@abc.com')
 
 
Now, while writing a Stored Procedure, the first step will be to write the Create Procedure statement as the first statement, 

Create  PROCEDURE Getstudentname(

@studentid INT          --Input parameter ,  Studentid of the student 

)
AS
BEGIN
SELECT Firstname+' '+Lastname FROM tbl_Students WHERE studentid=@studentid 
END


Note: It is not necessary that a stored procedure will have to written. It can be the case when a stored procedure doesn't written any thing. For Example, a stored procedure can be used to Insert, delete or update a sql statement. For Example the below stored procedure is used tp insert value into the table tbl_students.

/*
This Stored procedure is used to Insert value into the table tbl_students. 
*/

Create Procedure InsertStudentrecord
(
 @StudentFirstName Varchar(200),
 @StudentLastName  Varchar(200),
 @StudentEmail     Varchar(50)
) 
As
 Begin
   Insert into tbl_Students (Firstname, lastname, Email)
   Values(@StudentFirstName, @StudentLastName,@StudentEmail)
 End

Monday, December 16, 2013

insert xml data in sql and view in Gridview

Dear All,
Introduction:
Here I will explain how to insert xml data into SQL Server table and view in gridview.


Description:

My self face problem read data from xml fileand save in sql server 
NewFresh.ASPX:-

Step 1:- Create table in Databse (My datbase name is "kazi")
insert DB create table(mtblUser)
This is my table
CREATE TABLE [dbo].[mtblUser](
 [Sno] [nvarchar](50) NULL,
 [UserId] [nvarchar](50) NULL,
 [Password] [nvarchar](50) NULL,
 [UserName] [nvarchar](50) NULL,
 [Email] [nvarchar](50) NULL,
 [GroupIn] [nvarchar](50) NULL,
 [UserType] [nvarchar](50) NULL,
 [EmpID] [nvarchar](10) NULL,
 [Designation] [nvarchar](50) NULL,
 [SubGroup] [nvarchar](50) NULL,
 [ViewGroup] [nvarchar](50) NULL,
 [Status] [nvarchar](50) NULL
) ON [PRIMARY]

Step 2:-Create ASPX page.

<head runat="server">
    <title>insert xml data in sql and view in Gridview </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
    </div>
    </form>
</body>
</html> 


Step 3:-Create Xml File.

My XML File Name as “myXmlData.xml” and that would contains data like this  
first create xml file in your application (Right Click your application and select Add New Item >> Select XML file) and give name as “myXmlData.xml” and write following code in your .xml page like this 

<?xml version="1.0" encoding="utf-8" ?>
<NewDataSet>
  <Table>
    <Sno>28</Sno>
    <UserId>aatish</UserId>
    <Password>aa1234</Password>
    <UserName>Mohammad Aatish Khan</UserName>
    <Email>aatish@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>29</Sno>
    <UserId>abhishek</UserId>
    <Password>ab@1234</Password>
    <UserName>Abhishek Nath</UserName>
    <Email>abhishek@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>30</Sno>
    <UserId>admin</UserId>
    <Password>letmein</Password>
    <UserName>Admin</UserName>
    <Email>Admin</Email>
    <GroupIn>Admin</GroupIn>
    <UserType>Admin</UserType>
    <Designation>Admin</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
  </Table>
  <Table>
    <Sno>31</Sno>
    <UserId>alex</UserId>
    <Password>abin</Password>
    <UserName>Alex Ambrose</UserName>
    <Email>alex@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Driver</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>32</Sno>
    <UserId>amit</UserId>
    <Password>kumar</Password>
    <UserName>Amit Kumar</UserName>
    <Email>amit@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Office Assist</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>34</Sno>
    <UserId>anil</UserId>
    <Password>anil123</Password>
    <UserName>Anil Thapa</UserName>
    <Email>anil@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Driver</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>35</Sno>
    <UserId>aniruddha</UserId>
    <Password>an1234</Password>
    <UserName>Aniruddha Bhattacharjee</UserName>
    <Email>aniruddha@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Rural Energy Access</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>36</Sno>
    <UserId>anisha</UserId>
    <Password>an1234</Password>
    <UserName>Anisha K Bhattacharya</UserName>
    <Email>anisha@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>37</Sno>
    <UserId>arvind</UserId>
    <Password>anurag</Password>
    <UserName>Anurag Mittal</UserName>
    <Email>anurag@winrockindia.org</Email>
    <GroupIn>PMU</GroupIn>
    <UserType>S</UserType>
    <Designation>Manager-PMU</Designation>
    <SubGroup>PMU</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>38</Sno>
    <UserId>anurag</UserId>
    <Password>anurag</Password>
    <UserName>Anurag Mittal</UserName>
    <Email>anurag@winrockindia.org</Email>
    <GroupIn>PMU</GroupIn>
    <UserType>PM</UserType>
    <Designation>Manager-PMU</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>39</Sno>
    <UserId>ashirbad</UserId>
    <Password>as@1234</Password>
    <UserName>Ashirbad Raha</UserName>
    <Email>ashirbad@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>40</Sno>
    <UserId>bansi</UserId>
    <Password>anari</Password>
    <UserName>Raj Bansi</UserName>
    <Email>bansi@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Office Assist</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>41</Sno>
    <UserId>brij</UserId>
    <Password>brij</Password>
    <UserName>Brij Mohan Singh Rathore</UserName>
    <Email>brij@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Advisor</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>42</Sno>
    <UserId>chaman</UserId>
    <Password>cs123</Password>
    <UserName>Chaman Kumar Shukla</UserName>
    <Email>chaman@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Associate - Program Support</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>43</Sno>
    <UserId>chetan</UserId>
    <Password>baby04</Password>
    <UserName>Chetan Agarwal</UserName>
    <Email>chetan@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>44</Sno>
    <UserId>debajit</UserId>
    <Password>das123</Password>
    <UserName>Debajit Das</UserName>
    <Email>debajit@winrockindia.org</Email>
    <GroupIn>CLC</GroupIn>
    <UserType>PM</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>CDM &amp; Environment Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>46</Sno>
    <UserId>devendra</UserId>
    <Password>devendra</Password>
    <UserName>Devendra Sahu</UserName>
    <Email>devendra@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Project Assistant</Designation>
    <SubGroup>Rural Energy Access</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>47</Sno>
    <UserId>dhandapani</UserId>
    <Password>dh@1234</Password>
    <UserName>Dhandapani P T</UserName>
    <Email>dhandapani@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>48</Sno>
    <UserId>dharam</UserId>
    <Password>dh@1234</Password>
    <UserName>Dharam Vir Bhatia</UserName>
    <Email>dharamvir@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Finance Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Finance</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>49</Sno>
    <UserId>dharmendar</UserId>
    <Password>adityar</Password>
    <UserName>Dharmendar Rawat</UserName>
    <Email>dharmendar@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Officer Manager</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>50</Sno>
    <UserId>francis</UserId>
    <Password>sonali</Password>
    <UserName>Francis  Massey</UserName>
    <Email>francis@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>F &amp; A Assistant</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>51</Sno>
    <UserId>gaurav</UserId>
    <Password>demon</Password>
    <UserName>Gaurav Kumar</UserName>
    <Email>gaurav@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate - IT</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>52</Sno>
    <UserId>girish</UserId>
    <Password>geetarb</Password>
    <UserName>Girish Chandra</UserName>
    <Email>girish@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Driver</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>53</Sno>
    <UserId>hemant</UserId>
    <Password>anurag</Password>
    <UserName>Anurag Mittal</UserName>
    <Email>anurag@winrockindia.org</Email>
    <GroupIn>PMU</GroupIn>
    <UserType>S</UserType>
    <Designation>Finance Officer</Designation>
    <SubGroup>PMU</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>54</Sno>
    <UserId>jaison</UserId>
    <Password>jaison1</Password>
    <UserName>Jaison Jose</UserName>
    <Email>jaison@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>55</Sno>
    <UserId>jayahari</UserId>
    <Password>jayahari123</Password>
    <UserName>K M Jayahari</UserName>
    <Email>jayahari@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Biodiversity</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>56</Sno>
    <UserId>jobin</UserId>
    <Password>jobin</Password>
    <UserName>Jobin</UserName>
    <Email>jobin@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>System Admin</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>57</Sno>
    <UserId>jyoti</UserId>
    <Password>dhruv</Password>
    <UserName>Jyoti Deswal</UserName>
    <Email>jyoti@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Account Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>59</Sno>
    <UserId>kartar</UserId>
    <Password>tilak</Password>
    <UserName>Kartar Singh</UserName>
    <Email>kartar@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Driver</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>60</Sno>
    <UserId>kinsuk</UserId>
    <Password>mikomiko</Password>
    <UserName>Kinsuk Mitra</UserName>
    <Email>kinsuk@winrockindia.org</Email>
    <GroupIn>PO</GroupIn>
    <UserType>PM</UserType>
    <Designation>President</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>61</Sno>
    <UserId>kumarswamy</UserId>
    <Password>ku123</Password>
    <UserName>C K Kumarswamy</UserName>
    <Email>kumarswamy@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>62</Sno>
    <UserId>mahendar</UserId>
    <Password>mahendar</Password>
    <UserName>Mahendar Maurya</UserName>
    <Email>mahendar@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Project Officer</Designation>
    <SubGroup>Rural Energy Access</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>63</Sno>
    <UserId>mamta</UserId>
    <Password>mamta</Password>
    <UserName>Mamta Borgoyary</UserName>
    <Email>mamta@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>64</Sno>
    <UserId>manav</UserId>
    <Password>manav</Password>
    <UserName>Manav John N</UserName>
    <Email>manav@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Associate – IT</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>65</Sno>
    <UserId>manishs</UserId>
    <Password>wordpass</Password>
    <UserName>Manish Soni</UserName>
    <Email>manishs@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>66</Sno>
    <UserId>meenakshi</UserId>
    <Password>meenakshi</Password>
    <UserName>Meenakshi N. Kakar</UserName>
    <Email>meenakshi@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Associate – Program Support</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>67</Sno>
    <UserId>meenakshig</UserId>
    <Password>mini</Password>
    <UserName>Meenakshi Gusain</UserName>
    <Email>meenakshig@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Associate – Program Support</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>68</Sno>
    <UserId>monalisa</UserId>
    <Password>sen</Password>
    <UserName>Monalisa Sen</UserName>
    <Email>monalisa@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Biodiversity</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>69</Sno>
    <UserId>neerajs</UserId>
    <Password>ne@1234</Password>
    <UserName>Neeraj Shrivastava</UserName>
    <Email>neerajs@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>70</Sno>
    <UserId>nilanjan</UserId>
    <Password>ghose</Password>
    <UserName>Nilanjan Ghose</UserName>
    <Email>nilanjan@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>71</Sno>
    <UserId>pooja</UserId>
    <Password>pooja</Password>
    <UserName>Pooja</UserName>
    <Email>pooja@winrockindia.org</Email>
    <UserType>S</UserType>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>73</Sno>
    <UserId>preeti</UserId>
    <Password>gupta</Password>
    <UserName>Preeti Gupta</UserName>
    <Email>preeti@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>75</Sno>
    <UserId>rakesh</UserId>
    <Password>poonam</Password>
    <UserName>Rakesh Kumar</UserName>
    <Email>rakesh@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Office Assist</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>76</Sno>
    <UserId>ravi</UserId>
    <Password>vishnu</Password>
    <UserName>Ravi Chander Rangavajjula</UserName>
    <Email>ravi@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Consultant</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>77</Sno>
    <UserId>ravinder</UserId>
    <Password>sarif</Password>
    <UserName>Ravinder Kumar</UserName>
    <Email>ravinder@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Office Assist</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>78</Sno>
    <UserId>ritu</UserId>
    <Password>ri1234</Password>
    <UserName>Ritu Bharadwaj</UserName>
    <Email>ritu@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>PM</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>79</Sno>
    <UserId>sajit</UserId>
    <Password>kumars</Password>
    <UserName>Sajit Kumar</UserName>
    <Email>sajit@winrockindia.org</Email>
    <GroupIn>PMU</GroupIn>
    <UserType>S</UserType>
    <Designation>Associate – Program Support</Designation>
    <SubGroup>PMU</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>80</Sno>
    <UserId>sangeeta</UserId>
    <Password>dangi</Password>
    <UserName>Sangeeta Dangi</UserName>
    <Email>sangeeta@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Assistant Accounts Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Finance</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>82</Sno>
    <UserId>sanyogita</UserId>
    <Password>sanpan</Password>
    <UserName>Sanyogita Rawat</UserName>
    <Email>sanyogita@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Associate – Program Support</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>83</Sno>
    <UserId>sasi</UserId>
    <Password>sasi</Password>
    <UserName>Sasi M</UserName>
    <Email>sasim@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>84</Sno>
    <UserId>shahnaz</UserId>
    <Password>shahnaz</Password>
    <UserName>Shahnaz</UserName>
    <Email>shahnaz@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Rural Energy Access</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>85</Sno>
    <UserId>shankar</UserId>
    <Password>shankar123</Password>
    <UserName>Shankar Haldar</UserName>
    <Email>shankar@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>PM</UserType>
    <Designation>Senior Program Manager</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>86</Sno>
    <UserId>shankarp</UserId>
    <Password>sh@1234</Password>
    <UserName>P Shankar</UserName>
    <Email>shankarp@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Office Assistant</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>87</Sno>
    <UserId>sharda</UserId>
    <Password>sh1234</Password>
    <UserName>Sharda Prasad Gautam</UserName>
    <Email>sharda@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>88</Sno>
    <UserId>sharmila</UserId>
    <Password>mila</Password>
    <UserName>Sharmila Ghosh</UserName>
    <Email>sharmila@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Consultant</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>89</Sno>
    <UserId>sharmistha</UserId>
    <Password>tobleron</Password>
    <UserName>Sharmistha Bose</UserName>
    <Email>sharmistha@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>90</Sno>
    <UserId>shubraj</UserId>
    <Password>rajbundela</Password>
    <UserName>Shub raj</UserName>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Office Assistant</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>91</Sno>
    <UserId>smriti</UserId>
    <Password>sm@1234</Password>
    <UserName>Smriti Mishra</UserName>
    <Email>smriti@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>92</Sno>
    <UserId>sobhan</UserId>
    <Password>london</Password>
    <UserName>P.R.K. Sobhanbabu</UserName>
    <Email>sobhan@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>93</Sno>
    <UserId>somnath</UserId>
    <Password>somnath</Password>
    <UserName>Somnath Bhattacharjee</UserName>
    <Email>somnath@winrockindia.org</Email>
    <GroupIn>PO</GroupIn>
    <UserType>S</UserType>
    <Designation>Vice President</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>PMU</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>94</Sno>
    <UserId>somon</UserId>
    <Password>thithu</Password>
    <UserName>Somon Paul</UserName>
    <Email>somon@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Administrative Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>95</Sno>
    <UserId>sripal</UserId>
    <Password>sripal123</Password>
    <UserName>Sripal T</UserName>
    <Email>sripal@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>97</Sno>
    <UserId>sudipto</UserId>
    <Password>su~123</Password>
    <UserName>Sudipto Chatterjee</UserName>
    <Email>sudipto@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>98</Sno>
    <UserId>sumana</UserId>
    <Password>sumana</Password>
    <UserName>Sumana Bhattacharya</UserName>
    <Email>sumana@winrockindia.org</Email>
    <GroupIn>CLC</GroupIn>
    <UserType>S</UserType>
    <Designation>Expert Consultant</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>99</Sno>
    <UserId>sunandan</UserId>
    <Password>aa14</Password>
    <UserName>Sunandan Tiwari</UserName>
    <Email>sunandan@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>100</Sno>
    <UserId>sunpreet</UserId>
    <Password>sunnrm</Password>
    <UserName>Sunpreet Kaur</UserName>
    <Email>sunpreet@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>101</Sno>
    <UserId>test</UserId>
    <Password>test</Password>
    <UserName>testname</UserName>
    <Email>gaurav@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>102</Sno>
    <UserId>umesh</UserId>
    <Password>sam</Password>
    <UserName>Umesh Eric</UserName>
    <Email>umesh@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Driver</Designation>
    <SubGroup>OA</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>103</Sno>
    <UserId>urvashi</UserId>
    <Password>loris123</Password>
    <UserName>Urvashi Dogra</UserName>
    <Email>urvashi@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>105</Sno>
    <UserId>vivekm</UserId>
    <Password>vi@1234</Password>
    <UserName>Vivek Mehta</UserName>
    <Email>vivekm@winrockindia.org</Email>
    <GroupIn>CLC</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>CDM &amp; Environment Management Group</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>106</Sno>
    <UserId>varnana</UserId>
    <Password>va@1234</Password>
    <UserName>Varnana Sarkar</UserName>
    <Email>varnana@winrockindia.org</Email>
    <GroupIn>OUTREACH</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>107</Sno>
    <UserId>hansa</UserId>
    <Password>ha@1234</Password>
    <UserName>Hansa Verma</UserName>
    <Email>hansa@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Accounts Associate</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Finance</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>108</Sno>
    <UserId>sonal</UserId>
    <Password>so@1234</Password>
    <UserName>Sonal Mehta</UserName>
    <Email>sonal@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>109</Sno>
    <UserId>ramesh</UserId>
    <Password>ra@1234</Password>
    <UserName>Ramesh Chand</UserName>
    <Email>ramesh@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Accounts Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Finance</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>113</Sno>
    <UserId>csekhar</UserId>
    <Password>csekhar</Password>
    <UserName>Chandrasekhar</UserName>
    <Email>chandra@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Finance Advisor</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Finance</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>116</Sno>
    <UserId>gauravs</UserId>
    <Password>ga@1234</Password>
    <UserName>Gaurav Sharma</UserName>
    <Email>gauravs@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>117</Sno>
    <UserId>dinesh</UserId>
    <Password>di@1234</Password>
    <UserName>Dinesh Kapur</UserName>
    <Email>dinesh@winrockindia.org</Email>
    <GroupIn>CLC</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>CDM &amp; Environment Management Group</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>110</Sno>
    <UserId>gitika</UserId>
    <Password>gi@1234</Password>
    <UserName>Gitika Goswami</UserName>
    <Email>gitika@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>111</Sno>
    <UserId>vineet</UserId>
    <Password>vi@1234</Password>
    <UserName>Vineet Jain</UserName>
    <Email>vineet@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>112</Sno>
    <UserId>arvindl</UserId>
    <Password>ar@1234</Password>
    <UserName>Arvind Limje</UserName>
    <Email>arvindl@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>114</Sno>
    <UserId>aparupa</UserId>
    <Password>ap@1234</Password>
    <UserName>Aparupa Negi</UserName>
    <Email>aparupa@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Officer</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>115</Sno>
    <UserId>devishree</UserId>
    <Password>de@1234</Password>
    <UserName>Devishree</UserName>
    <Email>devishree@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Associate – Program Support</Designation>
    <SubGroup>Adaptation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>118</Sno>
    <UserId>girija</UserId>
    <Password>gi@1234</Password>
    <UserName>girija</UserName>
    <Email>girija@winrockindia.org</Email>
    <GroupIn>ENE</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>Energy Conservation</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>L</Status>
  </Table>
  <Table>
    <Sno>119</Sno>
    <UserId>kaushik</UserId>
    <Password>ka@1234</Password>
    <UserName>Kaushik Raj Hazarika</UserName>
    <Email>kaushik@winrockindia.org</Email>
    <GroupIn>CLC</GroupIn>
    <UserType>S</UserType>
    <Designation>Program Associate</Designation>
    <SubGroup>CDM &amp; Environment Management Group</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>120</Sno>
    <UserId>suresh</UserId>
    <Password>su@1234</Password>
    <UserName>Suresh Kumar</UserName>
    <Email>suresh@winrockindia.org</Email>
    <GroupIn>PSU</GroupIn>
    <UserType>S</UserType>
    <Designation>Chief Finance Officer</Designation>
    <SubGroup>N</SubGroup>
    <ViewGroup>Finance</ViewGroup>
    <Status>C</Status>
  </Table>
  <Table>
    <Sno>121</Sno>
    <UserId>rishu</UserId>
    <Password>ri@12345</Password>
    <UserName>Rishu Garg</UserName>
    <Email>rishu@winrockindia.org</Email>
    <GroupIn>NRM</GroupIn>
    <UserType>S</UserType>
    <Designation>Senior Program Officer</Designation>
    <SubGroup>Forest Management</SubGroup>
    <ViewGroup>Staff</ViewGroup>
    <Status>C</Status>
  </Table>
</NewDataSet>










 Step 4:-web.config file
 Connection String in web.config file

<connectionStrings>
    <add name="sqlconn" connectionString="Server=IBSPL_H-219-PC\SQLEXPRESS;database=kazi;Trusted_Connection=True"/>


</connectionStrings>

 Step 4:-Code behind part
Namespace:-

using System.Data.SqlClient;
using System.Data;
using System.Configuration;


public partial class NewFresh : System.Web.UI.Page
{
    string strsqlcon = ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString;
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();
        string path = Server.MapPath("~/myXmlData.xml");
        ds.ReadXml(path);
        SqlConnection con = new SqlConnection(strsqlcon);
        SqlBulkCopy sbc = new SqlBulkCopy(con);
        sbc.DestinationTableName = "mtblUser";
        sbc.ColumnMappings.Add("Sno", "Sno");
        sbc.ColumnMappings.Add("UserId", "UserId");
        sbc.ColumnMappings.Add("Password", "Password");
        sbc.ColumnMappings.Add("UserName", "UserName");
        sbc.ColumnMappings.Add("Email", "Email");
        sbc.ColumnMappings.Add("GroupIn", "GroupIn");
        sbc.ColumnMappings.Add("UserType", "UserType");
        sbc.ColumnMappings.Add("Designation", "Designation");
        sbc.ColumnMappings.Add("SubGroup", "SubGroup");
        sbc.ColumnMappings.Add("ViewGroup", "ViewGroup");
        sbc.ColumnMappings.Add("Status", "Status");
        try
        {
            con.Open();
            sbc.WriteToServer(ds.Tables[0]);
            SqlCommand cmd = new SqlCommand("Select * from mtblUser", con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds1 = new DataSet();
            da.Fill(ds1);
            GridView1.DataSource = ds1;
            GridView1.DataBind();


        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());

        }
        finally
        {
            con.Close();
        }

    }
}



If you run than data insert in table and display in gridview.





One important thing if you want to take data sources from you system for pls add the below line of code

Namespace:-
using System.IO;

Change the Path problem solve
StreamReader path = new StreamReader("D:\\myXmlData.xml");


 


 

Wednesday, November 20, 2013

Basic difference between .net 3.5 and 4.0

In this article I will explain difference between .net 3.5 and 4.0.


Difference between Framework 3.5 and Framework 4.0:

  1. EnableViewState - [true or false] in Framework 3.5
    EnableViewState -[Enabled/Disabled/Inherits] in Framework 4.0.


    2.Keyword and Description is added in Framework 4.0 while it is not available in Framework 3.5 in the Page Directives.

    3.use Multi-Targeting Feature:
    For using multi-targeting feature , users will have to add “targetframework” attribute in the compilation element of the web.config file. 


    Dear all i knew only this difference if some one know more pls welcome to add here