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
Showing posts with label C# using sql server. Show all posts
Showing posts with label C# using sql server. Show all posts
Subscribe to:
Posts (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...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...