Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Malik Aqeel
  Where is Malik Aqeel?
 Faisalabad
 Pakistan
 Malik Aqeel
 To: tushar
  Where is tushar?
 Panaji
 India
 tushar
 Tags
Subject: RE: how to insert bulk records
Thread ID: 185533 Message ID: 185601 # Views: 24 # Ratings: 0
Version: Visual FoxPro 9 Category: ODBC, ADO and OLEDB
Date: Thursday, July 24, 2008 11:34:23 AM         
   


> > 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

yes i do put in begin/end begin. my question is
that i call the procedure let us say "master" what is does
insert a row having information about that voucher and mid (master id)
than another procedure that put as many rows in the voucher in the detail
table along with mid (master id). but it all happens by calling the procedure
each time for each line. question is how to avoid calling procedure of detail
many time. i need to know how to get rows from cursor and insert these rows all
to gather in detail table at once.
hope i could clear the question.

Regards,
Abdul Aqeel



COMPLETE THREAD
how to insert bulk records Posted by Malik Aqeel @ 7/24/2008 6:13:26 AM
RE: how to insert bulk records Posted by tushar @ 7/24/2008 6:30:19 AM
RE: how to insert bulk records Posted by Malik Aqeel @ 7/24/2008 11:34:23 AM
RE: how to insert bulk records Posted by surinder singh @ 7/24/2008 12:09:56 PM
RE: how to insert bulk records Posted by Malik Aqeel @ 7/24/2008 1:03:55 PM