update 2 tables

G

Guest

I have a web form and when the user clicks update I have to update 2 seperate
tables, How can I do that? Right now I'm using straightline SQL for this.
 
K

Kevin Spencer

Run 2 queries?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.
 
G

Guest

I did that after i posted, BUT

How can i get the value of my check box? I have it based on a dataitem from
the database, but on the form the user can check it or uncheck it. How can I
determine if its checked or not and save it to the table?

I have this but its not saving:
if (checkbox1.checked == true)
{
value = 1;
}
else if (checkbox1.checked == false)
{
value = 0;
}
then i run my sql, but its not saving it to the table, its saving the state
it was when the page first loaded
 
J

Joe Van Meer

Hi there,

Are they related tables via an ID?

If so, u could have your submit button click event handle two sub routine
calls, each dealing with its own table. Of course the order of insertion
will depend on the relationship if any.
If they are related and you are using stored procedures and u need theat
first table's ID value you could use an output parameter on your first
stored procedure to send that nID back, then use that ID for the insert on
second table.
Public Sub btnSubmit_Click(ByVal Sender As Object, ByVal E As EventArgs)
Handles submitform.Click

InsertTableOne()
InsertTableTwo()

End Sub


An idea anyways, Joe :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top