Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
We used to generate DAl using code-smith .nettiers, so I made a custom stored procedural that takes two input parameters and returns an output one, the genrated method header looks like:
C#
public DataSet Test(System.Int32? p1, System.Int32? p2, ref System.Int32? p3)

i need to pass this dataset to a gridview,so what i did
C#
int start = 0;
int length = 2;
int? count = 0;

public void BindGrid() 
    {            
      DataSet ds = DataRepository.TableNameProvider.Test(start, length, ref count);
      TestGrid.VirtualItemCount =(int) count;
      TestGrid.DataSource = ds;
      TestGrid.DataBind();

then i call BindGrid() method into Page_Load(object sender, EventArgs e)
i got that error when calling BindGrid() method < Method not found: 'System.Data.DataSet ProjectName.Data.Bases.TableNameProviderBaseCore.Test(System.Nullable`1<int32>, System.Nullable`1<int32>, System.Nullable`1<int32> ByRef)'. >

Stack Trace:

[MissingMethodException: Method not found: 'System.Data.DataSet MSAD.Data.Bases.TableNameProviderBaseCore.Test(System.Nullable`1<int32>, System.Nullable`1<int32>, System.Nullable`1<int32> ByRef)'.]
MSADSP2013.test.test.BindGrid() +0
MSADSP2013.test.test.Page_Load(Object sender, EventArgs e) +166
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
Posted
Updated 30-Jun-13 3:55am
v3
Comments
Sampath Lokuge 30-Jun-13 8:09am    
I have updated the solution plz check that.

This may be a very late response but in .NET environment, when
int? x
is declared, if direct value cast or uses encountered down the track e.g.
x.ToString()
would cause this issue. Basically Nullable types do not provide Get method by default. If you require the value, you have to take one extra step which is x.Value as Get method is implemented here.

Thanks.
 
Share this answer
 
Comments
Member 11217420 11-Jan-18 5:59am    
Thanks a lot Its Right Ans.
For better solution you have to put whole code snippet.I mean the place which your Test method is being called.

May be your problem is when you called Test method,the object that Test method is called not instantiated (or Created) before that.So Check that.

Below mentioned link also may be help for you (may be similar kind of situation.But code was VB).
Check this out : Method not found: 'System.Data.DataSet PowerPay.DAL.Applications.GetDeliveryDelayDays()'.[^]

UPDATE

You have to check for null of DataRepository.TableNameProvider before calling the Test method.That may be the reason. Try and let me know.

As is below :

C#
if (DataRepository.TableNameProvider !=null)
{
      DataSet ds = DataRepository.TableNameProvider.Test(start, length, ref count);
      TestGrid.VirtualItemCount =(int) count;
      TestGrid.DataSource = ds;
      TestGrid.DataBind();
}


UPDATE 2

May be your problem is this : your Test method accepts all parameters are as nullable.But when you pass the values into it your first 2 parameters are seems non null.So change those param also as nullable is as below and try agin.

C#
int? start = 0;
int? length = 2;
int? count = 0;



I hope this will help to you.
 
Share this answer
 
v3
Comments
Member 10103122 30-Jun-13 7:39am    
Thank you for your reply, i updated the question in order to be more clear also i read the link you posted but still don't know what to do :(
thank you again
Member 10103122 30-Jun-13 9:06am    
:( it doesn't work
Sampath Lokuge 30-Jun-13 9:13am    
What do you mean by "it doesn't work"? When you check the null, is code successfully go to the inside the if condition or what happened when you put debug on that area?
Member 10103122 30-Jun-13 9:19am    
yes the code successfully go, but still gives the same error when calling BindGrid() in Page_Load()
Sampath Lokuge 30-Jun-13 9:29am    
Do you have other methods (other than "Test"),which is working when call like above ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900