Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 4th, 2007, 12:11 AM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to waiwaisan
Default problem unclosed quotation mark. HelpHelp

Hihi

Anyone cam help me? I am facing this problem when I key in the ' (apostrophe) then it occur runtime error. Error is problem for unclosed quotation mark before the character string '''


This is the code

'Method name: query
'Method Description: to run select-statement and return the results
'Parameters pass in: s (SQL select-statement)
' : cursorType (cursorType for connection)
' : lockType (connection lock type)
'Parameters return: query (recordset that stores the results)

Public Function query(ByVal sql As String, _
Optional ByVal cursorType As CursorTypeEnum = adOpenForwardOnly, _
Optional ByVal lockType As LockTypeEnum = adLockReadOnly) As ADODB.Recordset

On Error GoTo errHdl
Set query = New ADODB.Recordset
With query
.CursorLocation = adUseClient
.Open sql, con, cursorType, lockType
Debug.Print Time & " sql queried" & vbNewLine & _
vbTab & sql & vbNewLine & _
vbTab & "with " & query.RecordCount & " row(s) returned"
.ActiveConnection = Nothing
End With
Exit Function

errHdl:
Debug.Print Time & " error query sql" & vbNewLine & _
vbTab & sql & vbNewLine & _
vbTab & Err.description
Err.Raise Err.Number, "DB.query", Err.description <------- error

End Function

Hope anyone can help me. Thanks

 
Old January 4th, 2007, 05:29 AM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to waiwaisan
Default

no people know solve this problem? :(






Similar Threads
Thread Thread Starter Forum Replies Last Post
Unclosed IF statement SquishyB Classic ASP Basics 3 August 18th, 2006 01:24 AM
Quotation NEO1976 XML 5 July 19th, 2006 10:00 AM
display quotation mark in ASP angelran Classic ASP Basics 2 October 31st, 2005 08:03 AM
str_replace for quotation mark starsol Beginning PHP 4 August 21st, 2003 11:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.