ads

Monday, December 21, 2015

how to show oracle table in SharePoint page (gridView)


1. Create custom .aspx page in sharepoint
2. Edit page with sharepoint designer
3.Grab a  SqlDataSource  from the insert--> ASP.NET -->Data ToolBox and set up your connection string like below: 

<asp:SqlDataSource runat="server" ID="myOracleDBSourceProviderName="System.Data.OracleClient" ConnectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=[host name])(PORT=[port number]))(CONNECT_DATA=(SERVICE_NAME=[service name])));User ID=[username];Password=[Password];Unicode=True" SelectCommand="SELECT * FROM [view name] ">
</asp:SqlDataSource>

4. Grab a GridView from the insert--> ASP.NET -->Data ToolBox and then Set AutoGenerateColumns to False. 
- Add BoundField Columns in GridView and set the DataField and the HeaderText accordingly. See below:

<asp:GridView  runat="server" id="myOracleGridView" AutoGenerateColumns="False" DataSourceID="myOracleDBSourceAllowPaging="True">
<EmptyDataTemplate>No Records Found !</EmptyDataTemplate>

<Columns>
<asp:boundfield  DataField="column 1HeaderText="column 1SortExpression="column 1">
</asp:boundfield>
<asp:boundfield  DataField="column 2HeaderText="column 2SortExpression="column 2">
</asp:boundfield>
</asp:GridView>

5. Compile and run your page to see the output
Column 1 Column 2
Eve Jackson
John Adisu





No comments:

Post a Comment