| | |
vb recordset problem
![]() |
•
•
Join Date: May 2009
Posts: 5
Reputation:
Solved Threads: 0
i was trying to join two tables using a adodb mysql5.1 driver connection .i tried to print the record count in the record set .
no result was shown and the program is not responding . when i started debugging it was shown that the record set object was closed .........pls help me................ my code is
<code>
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.CursorType = adOpenStatic
myrs.LockType = adLockReadOnly
myrs.Open " SELECT memberpersonal.name,memberpersonal.memberid, FROM memberpersonal,memberunion where(memberunion.memberid = memberpersonal.memberid and memberpersonal.memberid = '" & cmbUnion.Text & "')", mydatabase
MsgBox myrs.RecordCount
thanks in advance........
</code>
no result was shown and the program is not responding . when i started debugging it was shown that the record set object was closed .........pls help me................ my code is
<code>
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.CursorType = adOpenStatic
myrs.LockType = adLockReadOnly
myrs.Open " SELECT memberpersonal.name,memberpersonal.memberid, FROM memberpersonal,memberunion where(memberunion.memberid = memberpersonal.memberid and memberpersonal.memberid = '" & cmbUnion.Text & "')", mydatabase
MsgBox myrs.RecordCount
thanks in advance........
</code>
•
•
Join Date: Mar 2009
Posts: 827
Reputation:
Solved Threads: 150
Should be something like...
Good Luck
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
myrs.Open " SELECT memberpersonal.name,memberpersonal.memberid, FROM memberpersonal, INNER JOIN memberunion ON memberpersonal.memberid = memberunion.memberid where memberunion.memberid = " & cmbUnion.Text , mydatabase
Good Luck
Last edited by vb5prgrmr; May 16th, 2009 at 2:41 am.
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
best way of practice in sql is that if you have a joined tables then use the keyword join (INNER JOIN, LEFT JOIN, RIGHT JOIN ETC...)
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim sqlSelect As String sqlSelect = " SELECT MP.name, MP.memberid " sqlSelect = sqlSelect & "FROM MemberPersonal MP " sqlSelect = sqlSelect & "INNER JOIN MembeRunion MR ON MP.memberid = MR.memberid " sqlSelect = sqlSelect & "WHERE MR.memberid = " & cmbUnion.Text myrs.Open sqlSelect , mydatabase
Last edited by jireh; May 18th, 2009 at 10:05 pm.
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
![]() |
Similar Threads
- Recordset problem (Visual Basic 4 / 5 / 6)
- Reading excel sheet into a recordset (Visual Basic 4 / 5 / 6)
- recordset problem (ASP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: How to Execute Stored Procedure in VB .. HELP
- Next Thread: how can i get Internet history
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






