Please help
Date: 06/02/06
(C Sharp) Keywords: database, asp
Hi All,
As I was doing this tutorial on VS 2005 , at the very end of part one I have encountered a problem, When I dragged and dropped the stored procedure onto the Dataset design view, and then went to modify the partial class for the dataset the following code gave me an error when translated to C#:
VB.Net
Public Function SubmitRating(ByVal LinkID As Integer, ByVal NewRating As Integer) As Long
Dim AvgRating As Long = 0 'output parameter returned
AvgRating = taSP.LinkRatingVote(LinkID, NewRating, AvgRating)
'update the avg rating in dataset
Dim row As LinkRow = Link.FindByLinkID(LinkID)
row.AvgRating = AvgRating
row.EndEdit()
row.AcceptChanges() 'no need to pass to the database
End Function
C#
public long SubmitRating(int LinkID, int NewRating)
{
long AvgRating = 0;
AvgRating = = taSP.LinkRatingVote(LinkID, NewRating, AvgRating)(LinkID, NewRating, AvgRating); Argument 3 cannot convert from long to ref int
LinkRow row = Link.FindByLinkID(LinkID);
row.AvgRating = AvgRating;
row.EndEdit();
row.AcceptChanges();
}
please help, what whould the correct code look like?
Update: - I tried changing AvgRating to an int, and called LinkRatingVote as follows :- taSP.LinkRatingVote(LinkID, NewRating, ref
AvgRating) I still had the same error saying the arguments aren't correct.
Source: http://community.livejournal.com/csharp/64406.html