• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Troubleshooting

Spaces in ADO Object Names

Q1:When I attempt to open a Command object on the views, functions, or stored procedures of NorthwindCS, I receive a “Syntax error or access violation” message.
A1: SQL Server 7.0+ (unfortunately) supports spaces in object names, such as views and stored procedures. However, SQL Server wants these names enclosed within double quotes. Sending double quotes in an object name string is a pain in VBA, but surrounding the object name with square brackets also solves the problem. For example, cnnName.CommandText= "Sales By Year" fails but cnnName.CommandText= "[Sales By Year]" works. Using square brackets for otherwise-illegal object identifiers is the better programming practice.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint