locked
problem in my objectdatasource RRS feed

  • Question

  • User-62667992 posted

    heyyy

    i ve a three layers application 

    here the database table

    here the dataset

    here the BLL layer 

     public bool AddRacer(string name1, string nationality1, string carname1, string cartype1, string teamname1, string phone1, string email1, int? ridersnum1,bool agree1)
        {
            // Create a new racerRow instance
            NRDataSet.racerDataTable racers = new NRDataSet.racerDataTable();
            NRDataSet.racerRow racerr = racers.NewracerRow();
    
            if (name1 == null) racerr.SetnameNull();
            else racerr.name = name1;
    
            if (nationality1 == null) racerr.SetnationalityNull();
            else racerr.nationality = nationality1;
    
             if (carname1 == null) racerr.SetcarnameNull();
             else racerr.carname = carname1;
    
             if (cartype1 == null) racerr.SetcartypeNull();
           else racerr.cartype= cartype1;
    
             if (teamname1 == null) racerr.SetteamnameNull();
            else racerr.teamname = teamname1;
    
            if (phone1 == null) racerr.SetphoneNull();
            else racerr.phone = phone1;
    
            if (email1 == null) racerr.SetemailNull();
            else racerr.email = email1;
    
            if (ridersnum1 == null) racerr.SetridersnumNull();
             racerr.ridersnum = ridersnum1.Value;
    
            racerr.agree = agree1;
    
            // Add the new product
            racers.AddracerRow(racerr);
            int rowsAffected = Adapter.Update(racers);
    
            // Return true if precisely one row was inserted,
            // otherwise false
            return rowsAffected == 1;
        }

    when  i run the code i get this

    ive noooooooooooooooo idea wat is that

    can u please help me

    Tuesday, May 3, 2016 4:49 PM

All replies

  • User465171450 posted

    Do you have it set to compare old values? It's passing two sets, which may mean it's looking to do a comparison, original to new.

    Wednesday, May 4, 2016 12:48 AM
  • User614698185 posted

    Hi arwa55,

    Could your provide your ObjectDataSource code? Based on your error, it may use wrong TypeName. From ObjectDataSource Class, it refers to the class which hosts the method, not the return type of the method, please see:

    https://msdn.microsoft.com/en-US/library/system.web.ui.webcontrols.objectdatasource.aspx

    Best Regards,

    Candice Zhou

    Wednesday, May 4, 2016 5:30 AM
  • User-62667992 posted
     <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" InsertMethod="AddRacer" SelectMethod="GetRacers" TypeName="RacerBLL" OldValuesParameterFormatString="{0}">
            <InsertParameters>
                <asp:Parameter Name="name1" Type="String" />
                <asp:Parameter Name="nationality1" Type="String" />
                <asp:Parameter Name="carname1" Type="String" />
                <asp:Parameter Name="cartype1" Type="String" />
                <asp:Parameter Name="teamname1" Type="String" />
                <asp:Parameter Name="phone1" Type="String" />
                <asp:Parameter Name="email1" Type="String" />
                <asp:Parameter Name="ridersnum1" Type="Int32" />
                <asp:Parameter Name="agree1" Type="Boolean" />
            </InsertParameters>
        </asp:ObjectDataSource>

    Wednesday, May 4, 2016 6:34 AM
  • User614698185 posted

    Hi arwa55,

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" InsertMethod="AddRacer" SelectMethod="GetRacers" TypeName="RacerBLL" OldValuesParameterFormatString="{0}"> 

    You should add namespace of RacerBLL in the TypeName, like below:

    Typename="Samples.RacerBLL"

    Best Regards,

    Candice Zhou

    Wednesday, May 4, 2016 9:47 AM
  • User-62667992 posted

    helloooo

    thankuuu for ur help

    its is a website not a project so i dont have a namespace

    i tried the website name like so 

    TypeName="NajranRace.RacerBLL" 

    but i get the error

    The type specified in the TypeName property of ObjectDataSource 'ObjectDataSource1' could not be found.

    Wednesday, May 4, 2016 2:28 PM
  • User614698185 posted

    Hi arwa55,

    The type specified in the TypeName property of ObjectDataSource 'ObjectDataSource1' could not be found.

    To create an instance of the object that the ObjectDataSource control binds to, the control uses reflection to load the type that is identified by the type name at run time. Therefore, the value of the TypeName property can be a partially qualified type for code that is located in the Bin or App_Code directories or a fully qualified type name for code that is registered in the global assembly cache. If you use the global assembly cache, you must add the appropriate reference to the assemblies section of the Machine.config or Web.config file.

    For more information, please see: http://forums.asp.net/t/1182641.aspx?The+type+specified+in+the+TypeName+property+of+ObjectDataSource+ObjectDataSource1+could+not+be+found+

    http://stackoverflow.com/questions/20328819/the-type-specified-in-the-typename-property-of-objectdatasource-could-not-be-fou

    Best Regards,

    Candice Zhou

    Thursday, May 5, 2016 8:36 AM
  • User-62667992 posted

    really thank u for ur reply

    my RacerBLL is a class that is located in the App_Code 

    im sorry i didnt get what u said i checked the links but still i cant see where is the problem or what is the solution

    Saturday, May 7, 2016 10:14 AM
  • User-1664007096 posted

    Hi arwa55,


    my RacerBLL is a class that is located in the App_Code

    im sorry i didnt get what u said i checked the links but still i cant see where is the problem or what is the solution

    According to your description, I have made a sample to try to reproduce this issue, unfortunately, I can't.

    So I suggest that you could configure ObjectDataSource with data components to check reproduce this issue, refer to like below:

    Otherwise could you provide "GetRacers" method sample code, that will help us reproduce and resolve it.

    Thursday, May 12, 2016 9:33 AM
  • User-62667992 posted

    hey 

    i found a very strange thing in the projects

    ive found 2 copies of my project in the class view when i open it 

    may be that what s causing the problem 

    u have idea why this happening and how can i solve it and can make the class view display one copy of my project

    and also my files is separated and distributed among these 2 copies 

    waaaaaaaaaat s happening

    Tuesday, June 7, 2016 10:40 AM