Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > add query result into table


Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2004, 09:08 PM
cnsg cnsg is offline
Newcomer
 
Join Date: Feb 2004
Posts: 22
Default add query result into table


suppose rst is the recordset after query,i want to create a temporary table on server to store them for use in next procedure,how can i add the recordset into the table? thanks!
Reply With Quote
  #2  
Old 04-16-2004, 03:16 AM
Shurik12 Shurik12 is offline
Steppe Walker

Retired Moderator
* Expert *
 
Join Date: Jul 2002
Location: Ukraine/Russia/Belgium
Posts: 7,227
Default

1) by looping through the 'source' recordset and execting "INSERT INTO ..." against the Connection or Command objects
2) by opening the second recordset (based on the target table), looping through
the 'source' recordset and using .AddNew method
3) by inlcuding the sql statement behind the 'source' recordset into the "INSERT INTO.." and executing it, meaning:
Code:
INSERT INTO Table1 (Field1, Field2) SELECT Field1, Field2 FROM Table2


Shurik.
__________________
"A diaper is not like a computer that makes satisfying burbling noises from time to time, hinting at great inner complexity." Malcolm Gladwell

"I'm sitting here completely surrounded by no beer." Onslow, 'Keeping up appearances'
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Result of SQL query in a textbox ? VBKid04 Database and Reporting 8 04-15-2004 07:29 AM
Result of SQL Query in textbox - 1st matching record is missing ? URGENT! VBKid04 Database and Reporting 1 04-14-2004 06:57 PM
How to generate a .xls file using a dbgird result or a sql query? Teixeira Excel 4 04-07-2004 10:45 AM
Make Table Query Updateable? Memnoch1207 Database and Reporting 1 05-02-2002 03:43 PM
How to compare an empty value in a query.. pragash Database and Reporting 1 10-23-2001 12:12 AM

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