|
-
Dec 20th, 2005, 12:56 AM
#1
Thread Starter
Lively Member
List problem
here i've got a problem i was just trying with my assesment so...
here i was doing my problem using listview but actually i didn't get mush knowledge bout listview till then i wanna just get u alls help...i've got to option button using control array so i was to display when i click on option buttons so here is my code with error ya so just plezz help me ya...
again when i compile the program error comes like this ...Operation is not allowed when the object is open c this also plezzz...
VB Code:
Private Sub optSelect_Click(Index As Integer)
Dim TItem As ListItem
Call data_connection
strSQL = ""
strSQL = "SELECT * FROM tblCustomer"
Set rsLv = gconn.Execute(strSQL)
'rsLv.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Select Case Index
Case 0
MsgBox rsLv("fldFirstName")
While Not rsLv.EOF
Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
rsLv("fldFamilyName"))
rsLv.MoveNext
Wend
Case 1
MsgBox rsLv("fldSuburb")
Do Until rsLv.EOF
'Set TItem = lvwCust.ListItems.Add(, , rsLv("fldSuburb"))
Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
rsLv("fldFamilyName") & " ( " & rsLv("fldSuburb") & ")")
rsLv.MoveNext
Loop
End Select
End Sub
Last edited by Hack; Dec 20th, 2005 at 06:43 AM.
-
Dec 20th, 2005, 12:59 AM
#2
Re: List problem
Why did you comment out the OPEN statement? That's what's closed.
-
Dec 20th, 2005, 01:05 AM
#3
Thread Starter
Lively Member
Re: List problem
u mean which one please i tried as u say but not getting any thing ya just again coming that error please if u don't mind give bit in detail ya i'm not getting n e thing ya...
till then thnx for ur help ya
-
Dec 20th, 2005, 01:11 AM
#4
Re: List problem
I hope that the data_connection opens the connection.
VB Code:
strSQL = ""
strSQL = "SELECT * FROM tblCustomer"
Set rsLv = gconn.Execute(strSQL)
rsLv.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
not sure exactly how you are doing this though.
-
Dec 20th, 2005, 01:12 AM
#5
Frenzied Member
Re: List problem
i think i see the problem here. the piece of code itself has no problems. the problem is in the procedure call data_connection IF, it contains certain things like provider definitions, open main connections etc....
-
Dec 20th, 2005, 01:15 AM
#6
Frenzied Member
Re: List problem
david, once u do the set rslv=gconn.execute, u dont need to open it again. as u can see in the red at the first post, the problem comes coz he's supposedly trying to change connection parameters while the connection is open.
-
Dec 20th, 2005, 05:53 AM
#7
Thread Starter
Lively Member
Re: List problem
thnx for ur kindness ya but i mean to say that ya i did it as u said but some problems comes. but here my problem is like this that i've two option buttons i was to display when i click on that particular option buttons but when i click on that particular option buttons doen't displays any thing using listview so now plezzz i hope u might've got my problem now ya...so plezz help me out ya...
my code here...
VB Code:
Private Sub optSelect_Click(Index As Integer)
Dim TItem As ListItem
Call data_connection
strSQL = ""
strSQL = "SELECT * FROM tblCustomer"
Set rsLv = gconn.Execute(strSQL)
'Here using control array to display the particular customer names when clicked
Select Case Index
'to display on the first listview
Case 0
While Not rsLv.EOF
Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
rsLv("fldFamilyName"))
rsLv.MoveNext
Wend
'to display on second listview
Case 1
Do Until rsLv.EOF
Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
rsLv("fldFamilyName") & " ( " & rsLv("fldSuburb") & ")")
rsLv.MoveNext
Loop
End Select
End Sub
so help me plezz...if don't get me sure to clearfy ya...
-
Dec 20th, 2005, 06:42 AM
#8
Re: List problem
Try
VB Code:
Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName")
TItem.Subitems(1) = rsLv("fldFamilyName")
-
Dec 22nd, 2005, 05:08 AM
#9
Thread Starter
Lively Member
Re: List problem
Thnx mr.Hack that is fine it is working all fine but the thing is that i was to display when i click on option button as i've stated as before u just have a look at my code once again ya.
thnx any ways all the helpers
-
Dec 22nd, 2005, 09:43 AM
#10
Re: List problem
 Originally Posted by kaylu_mo
Thnx mr.Hack that is fine it is working all fine but the thing is that i was to display when i click on option button as i've stated as before u just have a look at my code once again ya.
thnx any ways all the helpers
I don't understand.
You have two option buttons, or that is what it appears to be, and based on which is selected, you want to display the first row, and then, depending on what is selected, either the second and third row or just the second.
What are you having a problem with?
-
Dec 23rd, 2005, 01:27 AM
#11
Thread Starter
Lively Member
Re: List problem
yes i've two option buttons n i was to display when i click on the option buttons but the problem is when i click on which ever the option buttons their doen't displays any thing i tired in any way but its not working.the code is as stated as above ..
so that is the problem.
thnx
kaylu_mo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|