ASP.NET2005 Code problem

Closed
salman - Apr 12, 2009 at 05:48 PM
sha.me99
Posts
4
Registration date
Tuesday March 31, 2009
Status
Member
Last seen
June 5, 2009
- Apr 13, 2009 at 04:04 AM
Hello....I have written this code in asp.net2005 ,i tried to show data in gridview, but this code is giving eroor, please coreect the code.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


SqlConnection vs = new SqlConnection("Data Source=.;Initial Catalog=AdventureWorks;User ID=SALMAN;Password=a");



SqlConnection sc = new SqlConnection();
sc.Open();
SqlCommand scom = new SqlCommand("SELECT * FROM [Production].[Product]", sc);
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(scom);
sda.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
sc.Close();







}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}

1 reply

sha.me99
Posts
4
Registration date
Tuesday March 31, 2009
Status
Member
Last seen
June 5, 2009

Apr 13, 2009 at 04:04 AM
hi,
try this link to get some tutorials and examples to help you:
http://www.aspnettutorials.com/tutorials/
0