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
Manas MohapatraPosted Jul 15, 2015, 8:59 AM
Santhosh SubramaniamPosted Jul 1, 2015, 9:32 AM
Posted Jun 25, 2015, 8:41 AM
Upendra Pratap ShahiPosted Jun 25, 2015, 8:38 AM
Posted Jun 25, 2015, 8:36 AM
Jaipal ReddyPosted Jun 25, 2015, 8:32 AM
Posted Jun 25, 2015, 8:32 AM
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.
Santhosh SubramaniamPosted Jun 25, 2015, 8:20 AM
Rajeesh MenothPosted Jun 25, 2015, 7:35 AM
Posted Jun 25, 2015, 7:32 AM
Rajeesh MenothPosted Jun 25, 2015, 6:29 AM
Posted Jun 25, 2015, 6:19 AM
Rajeesh MenothPosted Jun 25, 2015, 5:49 AM
Posted Jun 25, 2015, 2:36 AM
Posted Jun 23, 2015, 6:25 AM
Posted Jun 23, 2015, 6:15 AM
Upendra Pratap ShahiPosted Jun 23, 2015, 6:14 AM
Posted Jun 23, 2015, 6:07 AM
Upendra Pratap ShahiPosted Jun 23, 2015, 5:12 AM
Pankaj Kumar ChoudharyPosted Jun 23, 2015, 4:14 AM
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
Niranjan PoddarPosted Jun 23, 2015, 4:08 AM
cmd.ExecuteNonQuery();