S
sparks
So far I have tried the microsoft version of this, and lost the table
LOl
so I tried this way to write to two tables carrying over the autoid
but so far I can not get the autonumber and put it in the other table.
thanks big time for any help
maybe I tried to do it the dumb way but it looks to me like this
should work
probably not
oh the passed values for person and member are are in the sql strings
at least I knew how to check that
sparks
==============================
the tblperson creates the autoid PersonID
but when I try to create it in tblmember I get an error on the first
ExecuteNonQuery.
==============================
public void SavePerson (Person person,Member member)
{
Connection.Open (); //ToShortDateString()
try
{
String sqlString = "insert into
tblPerson (ContractNumber,Name, Address, PhoneNumber, barcode)"+
"values (" +
person.getContractNumber() + ",'" +
person.getName() +"','" +
person.getAddress() +"','" +
person.getPhoneNum() +"','" +
person.getBarcodeNum() + "')";
OleDbCommand command = new
OleDbCommand (sqlString, Connection);
command.ExecuteNonQuery();
OleDbCommand cmd = new
OleDbCommand("SELECT @@IDENTITY", Connection);
int nId = (int)cmd.ExecuteScalar();
---------------------------------------------------------------------------------------------------------
String sqlStr = "insert into tblMember (personID,MonthlyFee,paidup)"+
"values (" + nId +
member.getFee() + "," + member.getMemValidation() + ")";
OleDbCommand comma = new OleDbCommand (sqlStr, Connection);
command.ExecuteNonQuery();
Connection.Close();
}
finally
{
if (Connection!= null)
{
if (Connection.State ==
ConnectionState.Open)
Connection.Close();
}
}
LOl
so I tried this way to write to two tables carrying over the autoid
but so far I can not get the autonumber and put it in the other table.
thanks big time for any help
maybe I tried to do it the dumb way but it looks to me like this
should work
probably not

oh the passed values for person and member are are in the sql strings
at least I knew how to check that
sparks
==============================
the tblperson creates the autoid PersonID
but when I try to create it in tblmember I get an error on the first
ExecuteNonQuery.
==============================
public void SavePerson (Person person,Member member)
{
Connection.Open (); //ToShortDateString()
try
{
String sqlString = "insert into
tblPerson (ContractNumber,Name, Address, PhoneNumber, barcode)"+
"values (" +
person.getContractNumber() + ",'" +
person.getName() +"','" +
person.getAddress() +"','" +
person.getPhoneNum() +"','" +
person.getBarcodeNum() + "')";
OleDbCommand command = new
OleDbCommand (sqlString, Connection);
command.ExecuteNonQuery();
OleDbCommand cmd = new
OleDbCommand("SELECT @@IDENTITY", Connection);
int nId = (int)cmd.ExecuteScalar();
---------------------------------------------------------------------------------------------------------
String sqlStr = "insert into tblMember (personID,MonthlyFee,paidup)"+
"values (" + nId +
member.getFee() + "," + member.getMemValidation() + ")";
OleDbCommand comma = new OleDbCommand (sqlStr, Connection);
command.ExecuteNonQuery();
Connection.Close();
}
finally
{
if (Connection!= null)
{
if (Connection.State ==
ConnectionState.Open)
Connection.Close();
}
}