473,383 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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.EventArgs) 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(strSQL, dc)
dc.Open()
dr = db.ExecuteReader
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.SubItems.Add(dr.Item(1))
lSingleItem.SubItems.Add(dr.Item(2))
lSingleItem.SubItems.Add(dr.Item(3))
lSingleItem.SubItems.Add(dr.Item(4))
lSingleItem.SubItems.Add(dr.Item(5))
lSingleItem.SubItems.Add(dr.Item(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 1751

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

Similar topics

22
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...
5
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...
0
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...
0
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...
2
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 :...
5
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...
2
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...
10
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...
0
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.