<tr> <td style="width: 90px"> <asp:GridView ID="gv" runat="server"> </asp:GridView> </td> <td style="width: 118px"> </td> </tr>
Protected Sub PopulateGridView() gv.DataSource = oDb.ListEmployeeDetails() gv.DataBind() Public Function ListEmployeeDetails() As DataTable command.Connection = OpenConn() command.CommandType = Data.CommandType.Text command.CommandText = "Select emp_id,emp_name,address,doj,dept_id,proj_id from Employee" reader = command.ExecuteReader() If (reader.HasRows) Then dt.Load(reader) End If Return dt End Function Public Function OpenConn() As SqlConnection conn = New SqlConnection(Connection()) Try If (conn.State = System.Data.ConnectionState.Closed) Then conn.Open() Return conn End If Catch ex As Exception Return Nothing End Try Return Nothing End Function Public ReadOnly Property Connection() As String Get Dim s As String s = ConfigurationManager.ConnectionStrings("DbConn").ConnectionString Return s End Get End Property End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)