HI
I have 3 text box and 1button in page
I want when users click on button it do two work
1-it insert some data from Estate_p table in Estate_s table and
2-insert textboxs text in to Estate_s columns
according to this thread
http://www.aspforums.net/Threads/168740/Insert-from-one-table-onto-another-in-SQL-Server-using-Query/
I can insert data from Estate_p table into Estate_s table
now I change query like below that moreover inserting data from other table it insert data from textboxs in Estate_s table
GO
ALTER procedure [dbo].[save]
@Id int
,@position nvarchar(40)
as
begin
set NOCOUNT ON;
insert into Estate_s(behcode,H_name,Tell)
select behcode,H_name,Tell
from Estate_p
where id=@Id
Insert into Estate_s(position)
values(@position)
end
and behind code
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string data = Server.UrlDecode(Request.QueryString["id"]);
SqlCommand _cmd = new SqlCommand("Baygani", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();
_cmd.Parameters.AddWithValue("@id", data);
_cmd.Parameters.AddWithValue("@position", Txtp.Text);
_cmd.ExecuteNonQuery();
_cn.Close();
}
}
my problem is that when I click button it insert data from Estate_p to Estate_s in one row
and it insert data in position column in other row I want both of them be in one row
Id
|
Behcode
|
H_name
|
Tell
|
Position
|
1
|
1111
|
house
|
1345668
|
null |
2
|
null
|
Null
|
Null
|
Canada
|
I want this
Id
|
Behcode
|
H_name
|
Tell
|
Position
|
1
|
1111
|
house
|
1345668
|
Canada
|
Tahnks alot