Inserting and retrieving values

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am trying to figure out the following information when storing some info
to the database, I don't know how to do this and therefore I am stuck.

I am going to try and explain this to the best of my ability.

I have two tables in my db, my first table I am writing the following
information to it.

ex....
// table one
FieldID, fName, lName, Address, State, Zip;

// table two
ParentID, Data;

// FieldID is an auto generated int field
FieldID.Value = 0;
fName.Value = "Jim";
lName.Value = "Anderson";
Address.Value = "747 Quarry Rd";
State.Value = "GH";
Zip.Value = "83920";
cmd.ExecuteNonQuery();

This is where I run into problems. For my second table, I need to get the
same FieldID
value for ParentID. How do I go about that? And I am really unsure on how
to write to two
different tables at the same time. Not at the same time, but one after the
other.

ParentID.Value = Table1.FieldID value (how do you do this?)

Can someone help me out with this?


Thanks


.



Relevant Pages

  • Re: Inserting and updating values
    ... If your database is SQL Server, I know that you can use an output parameter ... parent record and generate the new ID value "FieldID", ...
    (microsoft.public.dotnet.framework.adonet)
  • Inserting and updating values
    ... I am trying to figure out the following information when storing some info ... to the database, I don't know how to do this and therefore I am stuck. ... FieldID, fName, lName, Address, State, Zip; ... unsure on how ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How can I get a combo box to get data based on a text box?
    ... My FieldID is not numeric, ... numbers and letters. ... I put single quotes in like you said, entered the part # in, then ... Neither Kingston nor I can see your database, and you have chosen not to post ...
    (microsoft.public.access.forms)