| Author: Pascal 09 Jan 2009 | Member Level: Gold | Rating:  Points: 4 |
Here is the simple code.. Need to change the SqlDataSource accordingly.
<asp:DataGrid ID="dg1" runat="server" DataSourceID="SqlDataSource1"> </asp:DataGrid> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:StarTekConnectionString1 %>" ProviderName="<%$ ConnectionStrings:StarTekConnectionString1.ProviderName %>" SelectCommand="SELECT [EmpId], [StartDate], [EndDate], [ShiftLogic], [ShiftType] FROM [AAAEmp_Details]"> </asp:SqlDataSource>
|
| Author: Abhinav Misra 09 Jan 2009 | Member Level: Silver | Rating:  Points: 3 |
by default datagrid control is not shown in toll box of vs2005 and vs2008\ you have to add dll for that follow these step 1.go to you solution explorer 2.right click 3.click on add reference and select .net component 4.add datagrid dll
and then bound your datagrid control to the database table using property of datagrid as
1>data source 2>data bound
|
| Author: Syed Shakeer Hussain 09 Jan 2009 | Member Level: Diamond | Rating:  Points: 3 |
Hi
How to display data in DataGrid using DataSet
SqlConnection conn=new SqlConnection("your connection string"); conn.Open(); SqlDataAdapter adapter=new SqlDataAdapter("select * from emp",conn); SqlCommandBuilder builder=new SqlCommandBuilder(adapter); DataSet ds=new DataSet(); adapter.Fill(ds,"emp"); Datagrid1.DataSource=ds.Tabales["emp"];
Happy Coding....
Thanks & Regards! Syed Shakeer Hussain
|
| Author: Venkat 10 Jan 2009 | Member Level: Bronze | Rating:  Points: 1 |
Hai U Can Bind the Grid by So many Ways .By Using Datasources and With the help of DataSet And Datareader Also.Better to Go Thru DataReader
|