• subscribe
February 18, 2004 12:00 AM

34 Development Tips

SQL Server Pro
InstantDoc ID #41614
Downloads
41614.zip

When Do You Use Web Services?
Let's say that your company uses a supply-chain application that stores your customers' orders in a SQL Server database and keeps track of each order's status. Currently, when customers want to know which of their orders are pending, they contact your customer-service representative, who queries the database for that information. Customers then update their ordering systems. But suppose a customer wants to streamline the process by using an application to request order status directly from your system. To enable this type of access to your system, you and the customer need to agree on the interface the customer will use to make the request and the format in which you will return the requested data.

This scenario is an ideal application for Web services because you can use SOAP to build a single standards-based interface that works for many different customers with varying needs, regardless of the software applications and computing platform their enterprises use. Additionally, SOAP lets you build a loosely coupled interface that incorporates XML as the data format. (A loosely coupled application lets you reconfigure, redeploy, or relocate the implementation without affecting dependent applications.) By using XML, you gain extensibility that lets you expand the scope of the data you can provide to your customers in the future. Simply put, supplying a Web service lets you leverage the full value of XML's standard format, extensibility, and platform independence.

Ending Errors
Use error handling in your applications to prevent errors such as reaching the end or beginning of the recordset. You can use the EOF or BOF properties of the recordset to detect this error. For example, to check for the end of recordset when the user clicks the button, you can change the cmdNext_Click event to the following code:

If Not envNorthWind.rsCustomers.EOF]
Then envNorthWind.rsCustomers.MoveNext
End If

For a better approach, you can detect the end or beginning of the recordset and disable any navigation controls so that users can't click them. This method provides better feedback than letting the users click the button, then find out that they're at the end of the recordset.



ARTICLE TOOLS

Comments
  • Olivier Muff
    8 years ago
    Jun 17, 2004

    Excellent article! Can someone clarify the BLOB confict? The "SQL Tips for Developers" piece by Vaughn recommends we keep BLOB out of the database because of db cache flushing and IO performance. Then Otey's piece "Using the SqlCommand Object to Import BLOBs" tells us how to store BLOBs. Does Vaughn's recommendation stand (Storing BLOBs is bad practice) or should be put BLOBs in our DB's anyway? Will SS 2005 bring more efficient BLOB handling or separate data caches to make storing BLOBs a good idea?

  • shakti
    8 years ago
    Jun 15, 2004

    I am a certified DBA but haven't come across a more neat and elegant solution than this in my 3 years of experience (Refering to the aggregate multiplication). Have you published a book by any chance

  • Joan Braithwaite
    8 years ago
    Feb 27, 2004

    This is an excellent article, it combines a number of the issues that can really kill performance. I am an SQL Server DBA and I plan on sharing this info with our Development team. Thanks.

  • Craig
    8 years ago
    Feb 26, 2004

    you can not use DSN for benifit from SQL native provider

  • Rich Holt
    8 years ago
    Feb 24, 2004

    There is a bug in the script "Listing 1: Script to Refresh Views Owned by db_owner". Specifically, sysobjects.name is varchar(256), but the local variable declared in the script is varchar(30). If you try to execute this script against a database with views that have long names (> 30 characters) the script fails. To fix the problem, use these lines instead:

    DECLARE @ObjectName varchar(256)
    DECLARE @ObjectName_header varchar(300)

    Note that @ObjectName_header really only needs to be 11 characters longer than @ObjectName, but by leaving some extra space in the string, the user can modify the header without changing the variable declaration.

You must log on before posting a comment.

Are you a new visitor? Register Here