Solved

cannot update gridview with calculated column

Posted on 2009-07-10
3
342 Views
Last Modified: 2012-05-07
Hi,
ive got a table with these columns
ID,jobid,description,StartTIme and EndTime.

Then I created a stored procedure to return these fields + a calculated column to display the difference in hours from the StartTime and EndTime columns. This column is called TotalHrs.

In my objectdatasource, in the select list, i ve choosen this stored procedure. And in the UPDATE list i selected a stored procedure, that i created, to update those fields ( In the update procedure doesnt appear the column TotalHrs)

Now, the grid it is showing me the correct data with the difference in hours but when i try to update the record it says.( In this grid I added a template field to show the total hours bound to the stored procedure field TotalHrs)

"ObjectDataSource 'ods_timesheet' could not find a non-generic method 'spUpdateTimeSheet' that has parameters: JobID, Description, StartTime, EndTime, original_ID, totalhrs"

If i remove the template field 'TotalHrs' it updates fine.

any thoughts?

0
Comment
Question by:arcross
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 24821481
In your objectdatasource what does your UpdateParameters look like ?

Can we see some code..
0
 
LVL 8

Author Comment

by:arcross
ID: 24821548

<asp:ObjectDataSource ID="ods_TimeSheet" runat="server" 
                OldValuesParameterFormatString="original_{0}" SelectMethod="GetTimeSheetByDate" 
                TypeName="lstcTableAdapters.TimesheetTableAdapter" 
                InsertMethod="spInsertTimeSheet" UpdateMethod="spUpdateTimeSheet"
                >
                <UpdateParameters>
                    <asp:Parameter Name="JobID" Type="Int32" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="StartTime" Type="DateTime" />
                    <asp:Parameter Name="EndTime" Type="DateTime" />
                    <asp:Parameter Name="original_ID" Type="Int32" />
                </UpdateParameters>
                <SelectParameters>
                  
                     <asp:ControlParameter ControlID="txt_date" PropertyName="Text" Name="mytime" 
                         Type="DateTime" />
 
                </SelectParameters>
                <InsertParameters>
                    <asp:Parameter Name="JobID" Type="Int32" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="StartTime" Type="DateTime" />
                    <asp:Parameter Name="EndTime" Type="DateTime" />
                </InsertParameters>
                </asp:ObjectDataSource>

Open in new window

0
 
LVL 8

Accepted Solution

by:
arcross earned 0 total points
ID: 24838389
i found the answer.

I went back to the XSD file I added an extra column, in this case TOTALHRS.
Then i refreshed my objectdatasource to make the field 'TotalHrs' appear in the bound field list. SO after this, i made it Readonly = true and that worked.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question