locked
Sharepoint 2007 designer - sqldatasource and grid view not displaying on SP page (An unexpected error has occured) RRS feed

  • Question

  • Hi All,

    I am using sharepoint designer 2007 and am trying to use a sqldatasource to populate a gridview and then display that on an .aspx page. While in designer everything seems to configure okay. I am able to test the connection and display the data as expected from the sqldatasource within designer. Then I have the gridview control use the sqldatasource. At that point the grid (within designer) displays the headings as expected. The data that is displayed in the cells is "test data" rather than actual data value - I'm not sure if this is normal - for example, the data values in every column / row are all equal to 'abc'. Date values are all equal to current date.

    Then when I actually display the sharepoint page (via Preview in browser)  I get an error "An unexpected error has occurred".

    I am using SQLExpress on my laptop as the database for the sqldatasource. I have tried both integrated (windows) and SQL authentication with the same results.

    ---------------------------------------------------------------------------------------------------

    Here is the aspx code from designer:

    <asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
     <Columns>
      <asp:boundfield DataField="Case Creation Date Time" HeaderText="Case Creation Date Time" SortExpression="Case Creation Date Time">
      </asp:boundfield>
      <asp:boundfield DataField="Case #" HeaderText="Case #" SortExpression="Case #">
      </asp:boundfield>
      <asp:boundfield DataField="Source" HeaderText="Source" SortExpression="Source">
      </asp:boundfield>
      <asp:boundfield DataField="Priority" HeaderText="Priority" SortExpression="Priority">
      </asp:boundfield>
      <asp:boundfield DataField="Status" HeaderText="Status" SortExpression="Status">
      </asp:boundfield>
      <asp:boundfield DataField="Category" HeaderText="Category" SortExpression="Category">
      </asp:boundfield>
      <asp:boundfield DataField="Creator group" HeaderText="Creator group" SortExpression="Creator group">
      </asp:boundfield>
      <asp:boundfield DataField="Assigned Group" HeaderText="Assigned Group" SortExpression="Assigned Group">
      </asp:boundfield>
      <asp:boundfield DataField="Security Event Title" HeaderText="Security Event Title" SortExpression="Security Event Title">
      </asp:boundfield>
      <asp:boundfield DataField="Security Event Resolution Details" HeaderText="Security Event Resolution Details" SortExpression="Security Event Resolution Details">
      </asp:boundfield>
      <asp:boundfield DataField="SLA Achieved" HeaderText="SLA Achieved" SortExpression="SLA Achieved">
      </asp:boundfield>
      <asp:boundfield DataField="Event Reported Date Time" HeaderText="Event Reported Date Time" SortExpression="Event Reported Date Time">
      </asp:boundfield>
     </Columns>
     </asp:GridView>
     <br>
     <br>
     <br>
     <asp:SqlDataSource runat="server" id="SqlDataSource1" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=WN-MNA79GY0V0JD\SQLEXPRESS;Initial Catalog=CD_OPS_DATA;Persist Security Info=True;User ID=Sharepoint_User;Password=&quot;xxxxxx&quot;" SelectCommand="SELECT * FROM [Critical Cases] ORDER BY [Case Creation Date Time] DESC">
     </asp:SqlDataSource>
     <br>
     <br>
    &nbsp;</td>
     </tr>
    </table>
    </asp:Content>

    Any help is appreciated.

    Thanks !

    Tuesday, December 31, 2013 9:14 PM

Answers

  • Thanks Daniel.

    I am unable to connect to my SQL EXPRESS db on my laptop via SPD 2007: I get the error -

    I am able to access that database via SQL Server Mgmt. Studio (both with Windows and SQL Server authentication). I can also access a SQL Express database on a remote server from the exact same SPD 2007 session: I get -

    So, I wonder why I can connect to the remote but not the local? Anyway, if you have any ideas I would appreciate it. I am willing to do the work from the article you mention but wanted to rule out there being a simple DB access issue first.  I'll also start to find the ULS logs and review them.

    Thanks again !!

    Update on 1-3-14: Hi, since yesterday I also have been able to connect to the SQLEXPRESS database / table and display the .aspx page with the gridview in Visual Studio 2010.

    Update 1-26-14: Sorry for the delayed response.  I determined the reason why I could not connect to the SQLEXPRESS instance on my laptop was that there was a local host intrusion (firewall) rule on my machine that prevented an inbound connection on port 1433.  SharePoint server >>> inbound connect on port: 1433 >>> to Laptop device, not allowed. 

    Thanks.


    • Edited by chresther Thursday, January 16, 2014 4:10 PM
    • Marked as answer by chresther Thursday, January 16, 2014 4:10 PM
    Thursday, January 2, 2014 4:49 PM

All replies

  • Hi chresther,

    I tested per this article and it worked well.

    Please logon SharePoint site from IE browser firstly and view the page with this gridview control, see if it still has this error.

    And also may try re-creating the page with gridview control and data source, check if there are some mistakes in configuration.

    And you can check if there are some more detailed useful ULS log related to this issue for troubleshooting.

    Thanks


    Daniel Yang
    TechNet Community Support

    Thursday, January 2, 2014 8:14 AM
    Moderator
  • Thanks Daniel.

    I am unable to connect to my SQL EXPRESS db on my laptop via SPD 2007: I get the error -

    I am able to access that database via SQL Server Mgmt. Studio (both with Windows and SQL Server authentication). I can also access a SQL Express database on a remote server from the exact same SPD 2007 session: I get -

    So, I wonder why I can connect to the remote but not the local? Anyway, if you have any ideas I would appreciate it. I am willing to do the work from the article you mention but wanted to rule out there being a simple DB access issue first.  I'll also start to find the ULS logs and review them.

    Thanks again !!

    Update on 1-3-14: Hi, since yesterday I also have been able to connect to the SQLEXPRESS database / table and display the .aspx page with the gridview in Visual Studio 2010.

    Update 1-26-14: Sorry for the delayed response.  I determined the reason why I could not connect to the SQLEXPRESS instance on my laptop was that there was a local host intrusion (firewall) rule on my machine that prevented an inbound connection on port 1433.  SharePoint server >>> inbound connect on port: 1433 >>> to Laptop device, not allowed. 

    Thanks.


    • Edited by chresther Thursday, January 16, 2014 4:10 PM
    • Marked as answer by chresther Thursday, January 16, 2014 4:10 PM
    Thursday, January 2, 2014 4:49 PM