Click here to Skip to main content
15,885,365 members
Articles / Web Development / ASP.NET

Gridview inside Gridview in ASP.NET C#

Rate me:
Please Sign up or sign in to vote.
4.78/5 (19 votes)
9 Jun 2011CPOL1 min read 194K   8.4K   42  
Gridview inside Gridview in ASP.NET C# or Nested Gridview and Update, Delete from Gridview
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
/// <summary>
/// Summary description for query
/// </summary>
public class query
{
	public query()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static DataSet selectAll()
    {
        DataSet ds = new DataSet();
        string sql = "select * from emp_info";
        ds = Class1.fillDataset(sql);
        return ds;
    }
    public static DataSet selectwithId(long Id)
    {
        DataSet ds = new DataSet();
        string sql = "select * from emp_info where ID='" + Id + "'";
        ds = Class1.fillDataset(sql);
        return ds;
    }
    public static DataTable selectAllTBL()
    {
        DataSet ds = new DataSet();
        string sql = "select * from emp_info";
        ds = Class1.fillDataset(sql);
        DataTable dt = new DataTable();
        dt = ds.Tables[0];
        return dt;
    }
    public static int update(string Id,string name)
    {
        int r=0;
        string sql = "update emp_info set emp_name='" + name + "' where ID='" + Id + "'";
        r = Class1.nonquery(sql);
        return r;

    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer India
India India
http://devcorners.com/
Total DotNet/Programming Solution

I am Prasanta Banerjee. I am an Asp.Net Developer. My site: http://devcorners.com/
Email: prasanta.it@hotmail.com
If any body wants to prepare for interview http://guru-code.blogspot.com/ is the good site.

Comments and Discussions