I am working with VB6 and Access. There is a SQL query I have written to retrieve a few records. But when I try to display these records in a listbox, only the first one is fetched, others are not. What should I do to fetch all?? -
Call Connection
-
Set inv = New ADODB.Recordset
-
-
inv.Open "SELECT * FROM Invoice_Trans WHERE Inv_No=" & Val(txtInvNo.Text) & "", con, 3, 3
-
-
lstSrno.AddItem (inv!SrNo)
-
lstProd.AddItem (inv!Prod_Code)
-
lstQty.AddItem (inv!Qty)
-
lstAmt.AddItem (inv!amount)
-
-
rs.Close
-
4 2660
I am working with VB6 and Access. There is a SQL query i have written to retrieve few records. but when i try to display these records in a listbox, only the first one is fetched, others are not. What should i do to fetch all??
Call Connection
Set inv = New ADODB.Recordset
inv.Open "SELECT * FROM Invoice_Trans WHERE Inv_No=" & Val(txtInvNo.Text) & "", con, 3, 3
lstSrno.AddItem (inv!SrNo)
lstProd.AddItem (inv!Prod_Code)
lstQty.AddItem (inv!Qty)
lstAmt.AddItem (inv!amount)
rs.Close
this is my code on viewing records from the DB: -
Dim Ctrlst As Integer
-
Dim TmpValue As String
-
-
While Not adoUser.EOF
-
Ctrlst = Ctrlst + 1
-
lstLibrarian.ListItems.Add , , adoUser.Fields("BorrowerID")
-
For j = 1 To 6 'NUMBER OF COLUMNS IN THE LISTBOX
-
TmpValue = "" 'TEMPORARY STORAGE
-
If Not adoUser.Fields(j) = "" Then
-
TmpValue = adoUser.Fields(j)
-
End If
-
lstLibrarian.ListItems(Ctrlst).ListSubItems.Add , , TmpValue
-
Next
-
adoUser.MoveNext
-
Wend
-
Better Than Yesterday ^^
Hello,
Try This
Set Item = lvwRoom.ListItems.Add(, , inv!SrNo)
Item.SubItems(1) = inv!Prod_Code
Item.SubItems(2) = inv!Qty
like this
I am working with VB6 and Access. There is a SQL query i have written to retrieve few records. but when i try to display these records in a listbox, only the first one is fetched, others are not. What should i do to fetch all??
Call Connection
Set inv = New ADODB.Recordset
inv.Open "SELECT * FROM Invoice_Trans WHERE Inv_No=" & Val(txtInvNo.Text) & "", con, 3, 3
lstSrno.AddItem (inv!SrNo)
lstProd.AddItem (inv!Prod_Code)
lstQty.AddItem (inv!Qty)
lstAmt.AddItem (inv!amount)
rs.Close
try looping it upto the last record...
try like this -
Private Sub Form_Load()
-
Dim sql As String
-
lstcompany.Clear
-
sql = "SELECT companyname from company"
-
RsComp.Open sql, Con, adOpenDynamic, adLockOptimistic
-
Set lstcompany.DataSource = RsComp
-
-
For i = 0 To RsComp.RecordCount - 1
-
lstcompany.AddItem RsComp(0)
-
RsComp.MoveNext
-
Next i
-
RsComp.Close
-
-
-
End Sub
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: deebeetwo |
last post by:
I am trying to select only a certain number of records from a table.
It is easy enough with "fetch first" syntax. What complicates this a
bit is the fact that I need to retrieve the number of rows...
|
by: db2admin |
last post by:
hi,
For the following SQL and plan
==============================================================
SELECT Q1.PLCY_KY, Q1.PLCY_TRM_EFCTV_DT, Q1.ACNTG_BGN_DT,
CASE
WHEN ((Q1.PLCY_SRC_CD = '02')...
|
by: indhu |
last post by:
hi all,
Tables: story, shot
story-fieldnames, project, date episode
shot-fieldnames, scene,shot, filename(imagepath),action and dialogue.
Form has field from both the tables. how do i fetch...
|
by: nrain |
last post by:
Hi
This is nrain here
in a pl/sql block, some rows are getting inserted into the table violating the primary key and going to exception. I need to fetch records and want to check what...
|
by: Frank Swarbrick |
last post by:
Is there a way to do a multi-row fetch in to a COBOL table with DB2/LUW?
Apparently the following is supported in z/OS, but not LUW (or at least I
couldn't get it to work):
WORKING-STORAGE...
|
by: camarun20 |
last post by:
Hi ,
I constructed an MS access query in java to retrieve the rows in random.
The code snipet
Connection con = DriverManager.getConnection( database ,"","");
Statement s =...
|
by: Rilly |
last post by:
Anyone use PowerMovielist here? I have the 0.14 beta version.
Do you have a problem where some shows you search for cause the fetch to hang ? I'm pulling my hair out on this..
For example, I search...
|
by: padmaneha |
last post by:
Hi
Thanks for your response but the query which you gave in my previous post doesnt work. It displays the same cnt for movie reviews and videoreviews
Let me explain you in detail
As I...
|
by: Soniad |
last post by:
Hello,
In stored procedure, i am using query that fetches 2 columns record but single row. i have used cursor to fetch single record.
is there any way to fetch the record and put it in...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
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...
|
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...
| |