i want to update two table using one sql server statement and one update button .
but when i am run my code a error will be occur and that is
error:Incorrect syntax near the keyword 'INNER'.
my code is bellow .
SqlCommand cmd = new SqlCommand("UPDATE profilesrr INNER JOIN call_detailssr ON profilesrr.id = call_detailessr.profilesrr_id SET profilesrr.phone_number = '+ textpnumber.Text +', profilesrr.title = ' + texttitle.Text +',profilesrr.first_name = '+ textfname.Text +',profilesrr.middle_initial = '+ textmname.Text +',profilesrr.last_name = '+ textlname.Text +',profilesrr.address = '+ textadd.Text +',profilesrr.city = '+ textcity.Text +',profilesrr.state = '+ textstate.Text +',profilesrr.province = '+ textprovince.Text +',profilesrr.postal_code = '+ textpcode.Text +',profilesrr.country_code = '+ textccode.Text +',call_detailssr.call_in_date = '+ textcdate.Text +',call_detailssr.call_duration = '+ textcduration.Text +',call_detailssr.call_status = '+ textcstatus.Text +',WHERE profilesrr.id = 1", conn);
cmd.ExecuteNonQuery();
please help me
thanks in advance
Niranjan PoddarRank #2,683 · 519 reputationPosted Jun 23, 2015, 12:08 AM EDT
cmd.ExecuteNonQuery();
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jun 23, 2015, 12:14 AM EDT
UPDATE table1
SET table1.OrderAmount = table2.Amount
FROM dbo.Customers CUST
INNER JOIN dbo.table2ORDR
GO
UPDATE profilesrr SET profilesrr.phone_number = '+ textpnumber.Text +',profilesrr.title = ' + texttitle.Text +',profilesrr.first_name = '+ textfname.Text +',
profilesrr.middle_initial = '+ textmname.Text +',profilesrr.last_name = '+ textlname.Text +',profilesrr.address = '+ textadd.Text +',
profilesrr.city = '+ textcity.Text +',profilesrr.state = '+ textstate.Text +',profilesrr.province = '+ textprovince.Text +',
profilesrr.postal_code = '+ textpcode.Text +',profilesrr.country_code = '+ textccode.Text +',call_detailssr.call_in_date = '+ textcdate.Text +',
call_detailssr.call_duration = '+ textcduration.Text +',call_detailssr.call_status = '+ textcstatus.Text +'
FROM profilesrr
INNER JOIN call_detailssr
ON
profilesrr.id = call_detailessr.profilesrr_id
WHERE profilesrr.id = 1
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 23, 2015, 1:12 AM EDT
Posted Jun 23, 2015, 2:07 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 23, 2015, 2:14 AM EDT
Posted Jun 23, 2015, 2:15 AM EDT
Posted Jun 23, 2015, 2:25 AM EDT
Posted Jun 24, 2015, 10:36 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 25, 2015, 1:49 AM EDT
Posted Jun 25, 2015, 2:19 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 25, 2015, 2:29 AM EDT
Posted Jun 25, 2015, 3:32 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 25, 2015, 3:35 AM EDT
Santhosh Subramaniam189 reputationPosted Jun 25, 2015, 4:20 AM EDT
Posted Jun 25, 2015, 4:32 AM EDT
The multi-part identifier "profilesrr.id" could not be bound.
will be occurThe multi-part identifier "call_detailessr.profilesrr_id" could not be bound.
The multi-part identifier "profilesrr.id" could not be bound.
Jaipal ReddyRank #588 · 4.1K reputationPosted Jun 25, 2015, 4:32 AM EDT
Posted Jun 25, 2015, 4:36 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 25, 2015, 4:38 AM EDT
Posted Jun 25, 2015, 4:41 AM EDT
Santhosh Subramaniam189 reputationPosted Jul 1, 2015, 5:32 AM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Jul 15, 2015, 4:59 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts