> Dear experts,
>
> i am using sql server 2000 as backend and vfp9 as front end.using odbc to connect.
> I have a form named voucher. What i do is that I create a cursor.
> I have a grid based on that cursor. I search the Account code from
> search window and put debit or credit amount in the grid.
> my grid has following columns.
> Account Code, Account Title, Narration, Debit, Credit
>
> now once voucher completed. I call a stored procedure that check
> for next available voucher number and inset a row in master table
> as follow.
> mid (auto number), voucher date, voucher type, voucher number, userid, yearid,
> feeding date
> once i have now mid (auto number of row in master table where this voucher stored)
> than i put following row one by one in detail table linked with master table mid.
> mid (auto number from master table), account id (account id from chart of accounts),
> narration, debit, credit, srno
>
> if i have 5 rows in voucher than i have to call stored procedure 5 times.
>
> now my question is how to put all at once. in the same stored procedure
> it should insert master table row that will be only on row for each voucher than
> insert all five line at once with auto number from master table (mid).
>
> hope to have your detailed answer.
>
> Regards,
> Abdul Aqeel
Since you don't know the number of records in the child table, it would be difficult to put this in a procedure. Why don't you put this in a BEGIN TRANSACTION/END TRANSACTION.
Regards
Tushar