473,664 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Possible to write INSERT QUERY between While dr.read, End While?

lea

I have two combobox, I let the user to select report criteria FROM xx TO
xx.
i have a button call btnPrint to select report criteria and print
according to the criteria.

I able to SELECT the record based on the report criteria but i dunno
how to print it out with the use of crystal report,because for my
knowledge, Crystal report is only can retrieve all Records in the Table
with generated dataset.

My idea is generated a temporary table, i let user SELECT report
criteria then INSERT all the retrieved record to the temporary table.
after printing i write a delete query to refresh the tempary table.

I have been use this method for printing receipt, but this is bit
different. or any other idea to print it? :confused:
your help is highly appreciate!! :eek: this is emergency..
=============== =============== =============== =============
Private Sub btnPrint_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnPrint.Click
ListView1.Items .Clear()

Dim strSQL As String
strSQL = "SELECT * FROM [ItemMaster] WHERE Left(ItemCode,1 )
BETWEEN '" & ComboBox1.Text & "' AND '" & ComboBox2.Text & "' ORDER BY
ItemCode"
'strSQL = "SELECT * FROM [ItemMaster] WHERE
Left(ItemCode,1 )>='" & ComboBox1.Text & "' AND Left(ItemCode,1 )<='" &
ComboBox2.Text & "'"
Dim db As New OleDbCommand(st rSQL, dc)
dc.Open()
dr = db.ExecuteReade r
While dr.Read

' Im successfully retrieve the record and put in listview
' The problem is how can i INSERT the records has been retrieved to the
temparary table?

Dim lSingleItem As ListViewItem
lSingleItem = ListView1.Items .Add(dr.Item(0) )

lSingleItem.Sub Items.Add(dr.It em(1))
lSingleItem.Sub Items.Add(dr.It em(2))
lSingleItem.Sub Items.Add(dr.It em(3))
lSingleItem.Sub Items.Add(dr.It em(4))
lSingleItem.Sub Items.Add(dr.It em(5))
lSingleItem.Sub Items.Add(dr.It em(6))

End While
dr.Close()
dc.Close()
End Sub
--
lea
------------------------------------------------------------------------
lea's Profile: http://www.msusenet.com/member.php?userid=1569
View this thread: http://www.msusenet.com/t-1870530570

Jul 21 '05 #1
0 1763

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
3040
by: Robert Brown | last post by:
suppose I have the following table: CREATE TABLE (int level, color varchar, length int, width int, height int) It has the following rows 1, "RED", 8, 10, 12 2, NULL, NULL, NULL, 20 3, NULL, 9, 82, 25
5
2247
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the DataTable first and I then want to roll through the DataTable while in memory checking for errors and then commit the rows to my database table (btw this is in ASP.NET). Is it possible to have data in a datable before attaching at DataAdapter? I'm a...
0
4487
by: ImraneA | last post by:
Hi there I had pleasure of upsizing Access v97 db to Access v2K/SQL 2K. Wish to provide some knowledge gained back to community - hopefully help others. 1.Question how do you test stored procedure from SQL Server vs MS Access point of view ?
0
277
by: lea | last post by:
I have two combobox, I let the user to select report criteria FROM xx T xx. i have a button call btnPrint to select report criteria and prin according to the criteria. I able to SELECT the record based on the report criteria but i dunn how to print it out with the use of crystal report,because for m knowledge, Crystal report is only can retrieve all Records in the Tabl with generated dataset.
2
3195
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request : INSERT INTO temp_tab VALUES (1,2,3)
5
4064
by: robecflo | last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm developing with windows forms and vb.net, and oracle as a database. At this moment i have a table called amortizaciones, this table has a field called id_pasivo, which is foreign key to another table called pasivo, a consecutive field called no_cupon and a third field called date. So when i make a query (i.e select * from amortizaciones where id_pasivo = 522 order by...
2
1558
by: DavidOwens | last post by:
<form action="do.php" method="post"> <?php /* create table users (id int, staffid int, region varchar(20), firstname varchar(20), surname varchar(20)); insert into users values(1,1,'region1','John', 'Doe'),(2,2,'region1','Pete', 'Mackay'); create table stores (name varchar(10)); insert into stores values('Name1'),('Name2'),('Name3'),('Name4'),('Na me5'),('Name6'); */ $con = mysql_connect("localhost","root","password");
10
12692
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be certain that MyVar will be set to the key-field value that was created when the Append query ran. Now, there are other ways to do it - I know - that will ensure you 'nab' the correct record. But I was wondering
0
1616
by: David Michael Schruth, | last post by:
Hi, I am sort of in a jam here. I am using the PsycoPG2 library to read data out of a windows XP based PostGIS / PostGreSQL database but I am apparently unable to write (update or insert) even though I am able to read (select) I am using PsycoPG2 2.0.6 (psycopg2-2.0.6.win32-py2.5-pg8.2.4- release.exe ) with Python 2.5 (python-2.5.msi)
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.