I had used the SqlDataSource to retrieve data from database to gridview.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HRMS_DBConnectionString1 %>"
DeleteCommand="DELETE FROM [tblEmployeeDetail] WHERE [EmpId] = @EmpId" InsertCommand="INSERT INTO [tblEmployeeDetail] ([EmpId], [Name], [UserName], [Password], [Gender], [Age], [Address], [IdentityCardNo], [Race], [Position], [Section], [Department], [JoinDate], [ResignDate], [HodId], [Email]) VALUES (@EmpId, @Name, @UserName, @Password, @Gender, @Age, @Address, @IdentityCardNo, @Race, @Position, @Section, @Department, @JoinDate, @ResignDate, @HodId, @Email)"
ProviderName="<%$ ConnectionStrings:HRMS_DBConnectionString1.ProviderName %>"
SelectCommand="SELECT [EmpId], [Name], [UserName], [Password], [Gender], [Age], [Address], [IdentityCardNo], [Race], [Position], [Section], [Department], [JoinDate], [ResignDate], [HodId], [Email] FROM [tblEmployeeDetail] WHERE ([Name] IS NULL)"
For security purpose is there any ways so I can hide this coding. It obviously showing the table name and its entities all. I wish to use this function as its easier to manage data in gridview with direct auto edit and delete function but at sametime the presentation layer suppose not reveal the database content in coding. Is there anyway?
Are you under the impression that your code example will be present in the HTML and publicly view-able? It will not be. The
SQLDataSourceis compiled and generates data that is inserted into the various HTML elements before the page is ever served to the client.http://msdn.microsoft.com/en-us/library/ms178472.aspx#lifecycle_events