This is a migrated thread and some comments may be shown as answers.

SqlDataSource

3 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
michel
Top achievements
Rank 1
michel asked on 16 Aug 2011, 10:41 AM
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

3 Answers, 1 is accepted

Sort by
0
michel
Top achievements
Rank 1
answered on 17 Aug 2011, 01:45 PM
If anybody can hear me
pleeeeeeeeeeeeeeeeeeeeeeeease answer
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Aug 2011, 02:11 PM
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
0
michel
Top achievements
Rank 1
answered on 17 Aug 2011, 02:16 PM
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"
Tags
Grid
Asked by
michel
Top achievements
Rank 1
Answers by
michel
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or