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. linq to sql update

linq to sql update

Scheduled Pinned Locked Moved LINQ
databasecsharplinqannouncement
2 Posts 2 Posters 0 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.
  • U Offline
    U Offline
    User 1414935
    wrote on last edited by
    #1

    This statment works but I want to get the value of whatever the user inputted. I do not want a new row in sql, I just want to modifiy companyName. //Create new instance AlternaDB.MarketingDataContext db = new AlternaDB.MarketingDataContext(); //Call the table you want to use AlternaDB.Distributor distributor = db.Distributors.Single(d => d.CompanyName == "Nike"); AlternaDB.Distributor tbl = new AlternaDB.Distributor(); distributor.CompanyName = "krb"; db.SubmitChanges(); ShowDistributors(); CREATE TABLE [dbo].[Distributor]( [DistributorID] [int] IDENTITY(1,1) NOT NULL, [AccountType] [int] NULL, [AccountStatus] [int] NULL, [CompanyName] [varchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, )

    F 1 Reply Last reply
    0
    • U User 1414935

      This statment works but I want to get the value of whatever the user inputted. I do not want a new row in sql, I just want to modifiy companyName. //Create new instance AlternaDB.MarketingDataContext db = new AlternaDB.MarketingDataContext(); //Call the table you want to use AlternaDB.Distributor distributor = db.Distributors.Single(d => d.CompanyName == "Nike"); AlternaDB.Distributor tbl = new AlternaDB.Distributor(); distributor.CompanyName = "krb"; db.SubmitChanges(); ShowDistributors(); CREATE TABLE [dbo].[Distributor]( [DistributorID] [int] IDENTITY(1,1) NOT NULL, [AccountType] [int] NULL, [AccountStatus] [int] NULL, [CompanyName] [varchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, )

      F Offline
      F Offline
      Furty
      wrote on last edited by
      #2

      Member 1416254 wrote:

      This statment works but I want to get the value of whatever the user inputted

      This statement combined with your code sample makes no sense I'm afraid.. In order to perform the update your code would have to know both the old and the new the company name to begin with, thus nothing new to discover. Try re-phrasing your question so we can understand :wtf:

      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