Grid view in asp.net, C# using sql server
protected void Button3_Click(object sender, EventArgs e)
    {
        SqlConnection myConnection = new SqlConnection("user id=userid;" +                 "password=pwd;" + "Data source=localhost;" + "Integrated security=true;" +    "database=connectivitydb;");
        try
        {
            myConnection.Open();
        }
        catch (Exception f)
        {
            Console.WriteLine(f.ToString());
        }
        try
        {
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();
            da = new SqlDataAdapter("select * from agedetail", myConnection);
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        catch (Exception f)
        {
            Console.WriteLine(f.ToString());
        }
    }
                                                royalarun.blogspot.com by ArunPrakash
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
Subscribe to:
Post Comments (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
- 
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
 - 
View in Sql Server 2008 Creates a virtual table whose contents (columns and rows) are defined by a query. Use this statement to create a vie...
 - 
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...
 
No comments:
Post a Comment
Comments Welcome