Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. insert record other than AddToEntityName

insert record other than AddToEntityName

Scheduled Pinned Locked Moved LINQ
comsales
2 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    E ChaitanyaMalli
    wrote on last edited by
    #1

    Hi All, Till now i had seen one method to insert a record to the entity using AddToEntityName(EntityObject) ... but is there any other method instead of passing the EntityObject as parameter if we send the FieldNames and FieldValues as Parameters..... suppose say i have entity as Customer.. and fields are Customer | ------->CustomerID ------->Customer Name ------->Place ------->DOB basic method --- entity.AddToCustomer(objCustomer); is there any way to have like this... string str = "CustomerName=xxxx,Place=hyd,Dob=08-04-78"; entity.SomeMethod(str); a record is inserted to the table. Thanks in advance ;)

    Chaitanya.E chaitanya@cosmonetsolutions.com

    M 1 Reply Last reply
    0
    • E E ChaitanyaMalli

      Hi All, Till now i had seen one method to insert a record to the entity using AddToEntityName(EntityObject) ... but is there any other method instead of passing the EntityObject as parameter if we send the FieldNames and FieldValues as Parameters..... suppose say i have entity as Customer.. and fields are Customer | ------->CustomerID ------->Customer Name ------->Place ------->DOB basic method --- entity.AddToCustomer(objCustomer); is there any way to have like this... string str = "CustomerName=xxxx,Place=hyd,Dob=08-04-78"; entity.SomeMethod(str); a record is inserted to the table. Thanks in advance ;)

      Chaitanya.E chaitanya@cosmonetsolutions.com

      M Offline
      M Offline
      Michael J Eber
      wrote on last edited by
      #2

      You will only get something like that if you write a WCF service and have the parameters passed. Even then, your parameters would be strongly typed. Overall, though, I don't understand what you have against creating a new entity and calling an add. It guarantees your data is strongly typed and valid which cuts down on database chattiness. You will never find a database method where you are passing name value pairs to create a record.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups