hi me is new with asp .i don,t no how to display data from database using grid view in asp. thank to all dp member .Please help me.......
try tihs code protected void Page_Load(object sender, EventArgs e) { bindgrid(); } private void bindgrid() { SqlConnection sqlConnection = new SqlConnection ( "connectionString" ); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter ( "Select * From TableName", sqlConnection ); DataSet dataSet = new DataSet (); GridView1.DataSource = dataSet; GridView1.DataBind (); }
For a much more basic example: <asp:GridView ID="Gridview1" runat="server" DataSourceID="SqlDataSource1" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="connectionstring" SelectCommand="SELECT * FROM [TableName];" >
Hi..... There are two ways bind a database table with datagrid 1) With property window that is also called bound connectivity. 2) With Code that also called unbound connectivity. Web Designer | Real Estate Web Design