none
Error using SQL Server Database on DataFormWebPart

    คำถาม

  •  

    Hello,

     

    I'm using sharepoint services 3.0 and I'm trying to access my SQL server data into my sharepoint server.

    To do That i create a Database connection to my sql server table and used SQL authentication.

     

    After i drag and drop the connection to my sahrepoint designer 2007 design view.

     

    When i try to run my page it gives the following error:

     

    An error occurred during the compilation of the requested file, or one of its dependencies.

    Cannot convert type 'Microsoft.SharePoint.WebControls.SPSqlDataSource' to 'System.Web.UI.IAttributeAccessor'

     

     

    What is the problem?

    There is any tutorial in how to use Data Views and DataFormWebPart with sql server connections? 

    Thank you.

    20 ธันวาคม 2550 23:33

ตอบทั้งหมด

  • I have been able to connect to a sql server database, get the data to view on aspx page in data view web part, and insert record using data form web part.

     

    I created a new web part page from MOSS 2007.

    I opened the page in SharePoint Designer.

    I selected one of the web parts and hit delete.  This left the cursor in that table cell.

    On the data view menu, I selected insert data view.

    If the Data Source Library toolbox is already open, you could skip that last step.

     

    You already created the data connection, but I will repeat what I did that worked.

    In the Data Source Library toolbox, under "this site," I expanded the "Data Connections (0)"

    I clicked on the "create new data connection"

    I entered the SQL server name, the SQL server account name, and the password.

    I think then the name of the SQL database file (without the extension).

    This may have been available in a dropdown list.

    There was a button to test the connection.

    The connection then shows up in the Data Source Library toolbox.

    I selected the SQL connection in this toolbox.

    I selected "Show Data" from the menu that appeared.

    I selected a couple data fields (they show in one of the toolbox panes) so they were highlighted.

    At the top of this toolbox pane, there is a button to "Insert fields as "

    I clicked this button and selected multi-item view from the menu that appears.

    A data table then showed up in my central pane (on the aspx page, where I had the cursor).

     

    I hit save, then viewed the page on Sharepoint.

     

    Suggest trying your connection with a simple SQL file first, and connecting to a simple table, to isolate whether it is the WSS or an SQL problem.

     

    3 มกราคม 2551 7:19
  • An error occurred during the compilation of the requested file, or one of its dependencies. Cannot convert type 'Microsoft.SharePoint.WebControls.SPSqlDataSource' to 'System.Web.UI.IAttributeAccessor' -- This one is solved for me now I believe.  Apparently I added the data view web part into a blank cell (like you mention above) instead of first adding a web part zone, then adding the data view web part.  In Sharepoint Designer, click Insert > Sharepoint controls > web part zone.  Then click Insert > Sharepoint controls > data view web part.  This worked for me.  Hopefully this helps others.

    23 มิถุนายน 2551 19:52
  • My case solved the situation by changing "web.config":

    I added change of compilation mode in subfoder, and general (*) setting created this error statement on one previously working page. So instead code:

      <SharePoint>
        <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
          <PageParserPaths>
            <PageParserPath VirtualPath="/XXX_FOLDER/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />


    I used new (exact definition):

      <SharePoint>
        <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
          <PageParserPaths>
            <PageParserPath VirtualPath="/XXX_FOLDER/my_page_with_code.aspx" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />


    Hope that it helps to someone.

    9 ธันวาคม 2552 18:16
  • Hi all,

    If you got the following error when browsing the page created in SharePoint Designer with a DataView

    Cannot convert type 'Microsoft.SharePoint.WebControls.SPSqlDataSource' to 'System.Web.UI.IAttributeAccessor'

    You will need to check whether the DataFormWebPart is created within a webpart Zone.

    The solution would be insert the webpart zone first and then insert the dataview webpart within it.

    Tip: when you insert webpart zone or dataview, you will need to high light the area you want to insert in the Design view in SharePoint Designer

    SOLVED


    Guruprasad Marathe

    28 มิถุนายน 2555 11:57