Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4082930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:14:55+00:00 2026-05-20T18:14:55+00:00

I have two tables that I join sims and transactionlog and display in a

  • 0

I have two tables that I join sims and transactionlog and display in a Asp GridView using a SQLDatasource

Then I have an ASP GridView with the following select and update statements:

SelectCommand="SELECT * FROM sims s INNER JOIN TransactionLog AS tl ON s.id = tl.SimsId"     
UpdateCommand="UPDATE SET s.Notes=@Notes FROM sims s INNER JOIN TransactionLog AS tl ON s.id = tl.SimsId WHERE s.id=@id and tl.Id=@Id1"

Right now I only have the Notes column not set to readonly, but would like to add the others in later as soon as I can get the update statement to work for the notes column first.

When I try to update the notes column the error I’m getting is the following:
Incorrect syntax near the keyword ‘SET’.]

Mmm, hope my question is stated clearly enough.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:14:56+00:00Added an answer on May 20, 2026 at 6:14 pm

    This is how you write and SQL UPDATE statement with the FROM clause.

    drop table t2
    drop table t1
    go
    
    create table t1 (
    Id int not null identity(1,1) primary key,
    Name varchar(50) null
    )
    
    create table t2 (
    t1Id int not null foreign key references t1(id),
    Name varchar(50) null
    )
    
    insert into t1(name) values('T1Test1')
    insert into t1(name) values('T1Test2')
    insert into t2(t1Id, name) values(1, 'T2Test1')
    insert into t2(t1Id, name) values(2, 'T2Test2')
    
    -- Have a look at the data
    select * from t1 inner join t2 on t1.Id = t2.t1Id
    
    update t2 
    set t2.Name = 'T2Test1_changed'
    from t2 inner join t1 on t2.t1Id = t1.Id
    where t1.Id = 1
    
    -- See the changes
    select * from t1 inner join t2 on t1.Id = t2.t1Id
    

    This means that your statement should look like this:

    UPDATE sims
    SET s.Notes = @Notes 
    FROM sims s INNER JOIN TransactionLog tl ON s.id = tl.SimsId 
    WHERE s.id = @id and tl.Id = @Id1
    

    I do however doubt the WHERE clause. Maybe there’s no need to use both IDs there, but only you know that.

    Try you queries in SQL Management Studio before applying them in you application for a better debugging experience.

    Here is the MSDN docs on the UPDATE statement: http://msdn.microsoft.com/en-us/library/ms177523.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables that I am joining with the following query... select *
I have two tables that I join on the id-column, they look like: +-------+
I have two tables that I need to join... I want to join table1
I have two tables that are connected via a join table in a many-to-many
I have two tables that I am trying to join in a query, but
I have two tables that are not related using a foreign key but should
I have two tables that I'm currently joining on three fields: SELECT t1.A, t1.B,
I have two tables that I need to join. These are: art id |
I have two tables in MySQL that I'm comparing with the following attributes: tbl_fac
I have two tables that I am outer joining together: Post left outer join

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.