here i have a problem in saving thing. i have a form and a table connected to two different sql tables gate_outgoing and gateout_item.the form should go into the gate_outgoing and the table should go into the gateout_item table. i need to save this form along with the table and the values should enter to both the tables simultaneously. i simply need the code for the this or just tell me what to do with the following code...............
Protected Sub save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles save.Click
Dim connstr As String
Dim gp_no, in_decl_no, year As Integer
Dim belongs_to, whom, gp_date, issue_officer, purpose As String
Dim sno, total_packets, qty As Integer
Dim desc, make, equip_sno As String
connstr = ConfigurationManager.ConnectionStrings("gate").ConnectionString()
Dim conn As New SqlConnection(connstr)
conn.Open()
gp_no = s_no.Text
year = TextBox7.Text
belongs_to = belongs.Text
whom = t.Text
gp_date = CDate(dates.Text)
in_decl_no = declare_no.Text
issue_officer = officer.Text
purpose = pur.Text
sno = s_no1.Text
sno = s_no2.Text
sno = s_no3.Text
desc = desc1.Text
desc = desc2.Text
desc = desc3.Text
make = make1.Text
make = make2.Text
make = make3.Text
equip_sno = equip_no1.Text
equip_sno = equip_no2.Text
equip_sno = equip_no3.Text
qty = qty1.Text
qty = qty2.Text
qty = qty3.Text
total_packets = packets1.Text
total_packets = packets2.Text
total_packets = packets3.Text
Dim insert As New SqlClient.SqlCommand("insert into gate_outgoing (gp_no,year ,belongs_to ,[to],gp_date,in_decl_no,issue_officer,purpose) Values('" & gp_no & "' ,'" & year & "', '" & belongs_to & "','" & whom & "',CONVERT(datetime ,'" & gp_date & "', 103),'" & in_decl_no & "','" & issue_officer & "','" & purpose & "')", conn)
'Dim insert As New SqlClient.SqlCommand("insert into gateout_item (sno,year ,desc ,make,equip_sno,qty,total_packets) Values('" & sno & "' ,'" & desc & "', '" & make & "','" & equip_sno & "','" & qty & "','" & total_packets & "')", conn)
insert.ExecuteNonQuery()
conn.Close()
MsgBox("record saved")
End Sub
i need it urgently. hope i get the solution for this one