|
-
Dec 12th, 2005, 02:01 AM
#1
Thread Starter
Lively Member
DataGrid
here i've got problem with datagrid....as i was not solving using datacontrol but using a recordset actually i've two datagrid n just to display from the click event of lstPupils so this error somes....as code is stated as below...
VB Code:
Private Sub lstPupil_Click()
Dim intID As Integer
Call data_connection
intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
Set rsCom1 = gconn.Execute(strSQL)
'rsCom.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rsCom1 Error here...[COLOR=Red]The rowset is not bookmarkable
[/COLOR]
strSQL = "SELECT Description FROM tblCompetency WHERE Code IN(SELECT Code FROM tblPass WHERE ID=" & CStr(intID) & ")"
Set rsCom2 = gconn.Execute(strSQL)
Set Me.DataGrid2.DataSource = rsCom2
End Sub
]
wat is there so plezz do help me
-
Dec 12th, 2005, 02:32 AM
#2
Re: DataGrid
Use a client-side cursor...
VB Code:
Private Sub lstPupil_Click()
Dim intID As Integer
Call data_connection
intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
[B]rsCom1.CursorLocation = adUseClient[/B]
'Set rsCom1 = gconn.Execute(strSQL)
rsCom.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rsCom1
strSQL = "SELECT Description FROM tblCompetency WHERE Code IN(SELECT Code FROM tblPass WHERE ID=" & CStr(intID) & ")"
Set rsCom2 = gconn.Execute(strSQL)
Set Me.DataGrid2.DataSource = rsCom2
End Sub
-
Dec 12th, 2005, 05:57 AM
#3
Thread Starter
Lively Member
Re: DataGrid
here i did as u said but it didn'tworked out ya....some erro pop ups saying
operation is not allowed when object is open
but just after clicking i gat a record but when clicking to next records in lstpupils....
n e ways belows describes in detals see my code aonce again ya...
thanx for ur help....
VB Code:
Private Sub lstPupil_Click()
Dim intID As Integer
' On Error GoTo err_trap
Call data_connection
intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
rsCom1.CursorLocation = adUseClient
'Set rsCom1 = gconn.Execute(strSQL)
rsCom1.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rsCom1
strSQL = "SELECT Description FROM tblCompetency WHERE Code IN(SELECT Code FROM tblPass WHERE ID=" & CStr(intID) & ")"
'Set rsCom2 = gconn.Execute(strSQL)
rsCom2.CursorLocation = adUseClient
rsCom2.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid2.DataSource = rsCom2
Exit Sub
'err_trap:
' Dim strMsg As String
gconn.Close
End Sub
so help me plezzz....
-
Dec 12th, 2005, 07:59 PM
#4
Re: DataGrid
Then create another recordset object for your grid's datasource...
-
Dec 12th, 2005, 10:55 PM
#5
Thread Starter
Lively Member
Re: DataGrid
i did it as u say but it doesn't displays nothing..
but u just see once how i did it ya...
here is my code ...
thnx for ur help dee_uu
VB Code:
Private Sub lstPupil_Click()
Dim intID As Integer
Call data_connection
intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
rsDGrid.CursorLocation = adUseClient
rsCom1.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rsDGrid
gconn.Close
End Sub
thnx ..
kaylu_mo
-
Dec 12th, 2005, 11:42 PM
#6
Re: DataGrid
VB Code:
Private Sub lstPupil_Click()
Dim intID As Integer
Call data_connection
intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
rsDGrid.CursorLocation = adUseClient
[B]rsDGrid[/B].Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rsDGrid
gconn.Close
End Sub
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
|