Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Enterprise
Expertise: Intermediate
Apr 23, 1998

Make Sure You are Connected to the Right Database

When issuing SQL statements against SQL Server, consider fully equating all of your table or procedure names to include the database name, especially if you are using an existing data source. Users have the ability to change the default database for their data source, which could cause your program (SQL calls) to fail because they can't find what you are talking about. You can also define the database you are connecting to when you open a connection, which will override the users' default.
 
Private Sub LoadGrid()
    Dim sSql as string

    'Example of specifying full name of database and table
    sSql = "select * from pubs.dbo.authors " &_
              "where au_lname = 'Smith'"
    _
End Sub
Joe Karbowski
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date