SqlDataSource

4 posts, 0 answers
  1. michel
    michel avatar
    6 posts
    Member since:
    Aug 2011

    Posted 16 Aug 2011 Link to this post

    hi, everyone
    i,m trying to make a visual web part with vs 2010 for SharePoint 2010
    I put a radgrid on the page but there is no SqlDataSource in the toolbox
    so iwrith the datasource in the html cod like this:


         <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:tryoneConnectionString %>"
            DeleteCommand="DELETE FROM [ts] WHERE [ticketnumber] = @ticketnumber"
            InsertCommand="INSERT INTO [ts] ([Category], [Issue], [description], [Requester], [email], [computername], [hdstatus]) VALUES (@Category, @Issue, @description, @Requester, @email, @computername, @hdstatus)"
            SelectCommand="SELECT [ticketnumber], [Category], [Issue], [description], [Requester], [email], [computername], [hdstatus] FROM [ts]"
            
            
                        
                        UpdateCommand="UPDATE [ts] SET [Category] = @Category, [Issue] = @Issue, [description] = @description, [Requester] = @Requester, [email] = @email, [computername] = @computername, [hdstatus] = @hdstatus WHERE [ticketnumber] = @ticketnumber"
                        
                        ProviderName="<%$ ConnectionStrings:tryoneConnectionString.ProviderName %>">
            <DeleteParameters>
                <asp:Parameter Name="ticketnumber" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Category" Type="String" />
                <asp:Parameter Name="Issue" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="Requester" Type="String" />
                <asp:Parameter Name="email" Type="String" />
                <asp:Parameter Name="computername" Type="String" />
                <asp:Parameter Name="hdstatus" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Category" Type="String" />
                <asp:Parameter Name="Issue" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="Requester" Type="String" />
                <asp:Parameter Name="email" Type="String" />
                <asp:Parameter Name="computername" Type="String" />
                <asp:Parameter Name="hdstatus" Type="String" />
                <asp:Parameter Name="ticketnumber" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

    then i have found the datasource on the page i bind it to the radgrid
    everything is ok
    when i run the project i got the following error:

    The connection name 'tryoneconnectionstring' was not found in the applications configuration or the connection string is empty.
    my web.config & app.config in the attached
  2. michel
    michel avatar
    6 posts
    Member since:
    Aug 2011

    Posted 17 Aug 2011 Link to this post

    If anybody can hear me
    pleeeeeeeeeeeeeeeeeeeeeeeease answer
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 17 Aug 2011 Link to this post

    Hello,

    Please recreate your SqlDataSource using below link.

    http://www.asp.net/data-access/tutorials/querying-data-with-the-sqldatasource-control-vb

    let me know if any concern,

    Thanks,
    Jayesh Goyani
  5. michel
    michel avatar
    6 posts
    Member since:
    Aug 2011

    Posted 17 Aug 2011 Link to this post

    thanks so so so much for your reply but in sharepoint projects you can not drag SqlDataSource from the tool box to the visual web part
    you have to write it in code
    so i made a simple web application then i have copied it's sqldatasource code to the sharepoint project
    so i got the error of "connectionstring is empty"
Back to Top