A casting error occured

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kanimozhiz
    New Member
    • May 2008
    • 11

    A casting error occured

    I have created the Data access Logic component and when I execute the DALC an error occured like this "Cannot implicitly convert type 'x' to 'y'. An explicit conversion exists (are you missing a cast?) "

    This error occured while I was trying to insert the records in the DB through the DAL component.
    plz help me if anyone know the solution for this. Reply me as soon as possible, its very urgent....

    Thanks in advance.

    Regards,
    kani.z
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    These type of questions make my headhurt.
    They exception message tells you everything you need to know.
    Somewhere you are trying to convert one object to another.
    The fact that it tells you an explicit conversion exists, means you can type-cast it.
    Go to the offending objects and type cast one to match the object you are assigning it to.

    Comment

    • kanimozhiz
      New Member
      • May 2008
      • 11

      #3
      Originally posted by Plater
      These type of questions make my headhurt.
      They exception message tells you everything you need to know.
      Somewhere you are trying to convert one object to another.
      The fact that it tells you an explicit conversion exists, means you can type-cast it.
      Go to the offending objects and type cast one to match the object you are assigning it to.

      Thanks for ur reply.

      I am new to C# .net I don't know how to type cast? Can u tell me how to type cast with the example coding, then it will be very useful for me to understand better.

      Thanks & regards,
      kani.z

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by kanimozhiz
        Thanks for ur reply.

        I am new to C# .net I don't know how to type cast? Can u tell me how to type cast with the example coding, then it will be very useful for me to understand better.

        Thanks & regards,
        kani.z
        You really should invest in a good C# book.
        This is basic stuff that should be covered in the first chapters of any programming book.

        Check out the MSDN library if you cannot afford a book. There are lots of tutorials and every topic is covered.

        For instance Casting using C# is covered here.

        Cheers!

        -Frinny

        Comment

        Working...