Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Adding new records...


Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2001, 08:11 AM
Nemu Nemu is offline
Regular
 
Join Date: May 2001
Location: Montreal, Quebec, Canada
Posts: 85
Question Adding new records...


Is ti possible to add more than one record at a time in a table with an .addnew/.update structure???

And if no what should I use to do it??

__________________
There is no good and no bad, just perspective and opinion.
Reply With Quote
  #2  
Old 06-04-2001, 08:31 AM
ANUNEZ
Guest
 
Posts: n/a
Default Re: Adding new records...

I don't know if I got you right, but yes you can do it. It something like this:

Create a loop to iterate a many times as you or the user one. for example this could be use to pass all the records from one recordset to another:


rstSource.movefirst

do while not rstSource.eof

rstTarget.addnew
rstTarget![ID] = rstSource![ID]
rstTarget.update

rstSource.movenext


loop


You must initialize the recoldsets and close them at the end

I hope this help.

Reply With Quote
  #3  
Old 06-04-2001, 09:12 AM
anhmytran anhmytran is offline
Senior Contributor

Retired Moderator
* Guru *
 
Join Date: Aug 1999
Location: Hartford, Connecticut, 06
Posts: 1,487
Default Re: Adding new records...

ANUNEZ is partly correct.

No. You cannot "add more than one record at a time in a table with an .addnew/.update structure."
You can use it many times to add more record to the table.

You may use ANUNEZ's approach.
You may use the source as "INSERT INTO YourTable (PrimaryKey and other required fields, separated
by the comman in this parenthesis) VALUES PrimValue, ReqField1Value, ReqField2Value, SoOnValue;"
This source help adding many records to the table without loop.

AnhMy_Tran
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->