Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 5th, 2008, 12:36 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default Data Shaping Connection String

Hello all - Have seen something for the first time today which has me a little confused. After reading up on 'Data Shaping' I have figured the person who built the app I am working on may have complicated it.

Id this Data shaping realy neccessary? The application is giving me:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

On the followig line:

sDataShapingConnectionString = "Provider=MSDataShape; Data " & Application("SQLServer_ConnectionString")

While continue to research and troubleshoot this, any ideas how to resolve?????

TYIA

Wind is your friend
Matt
www.elitemarquees.com.au
__________________
Wind is your friend
Matt
Reply With Quote
  #2 (permalink)  
Old August 5th, 2008, 01:23 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Matt,

Whether you need it or not depends on the actual code, which may be pretty hard to figure out.

Datashaping lets you retrieve associated records as a "column"(, or a chapter as it's called if I recall correctly). For example, consider this custom result set
Code:
Id    CustomerName      AssociatedOrders
123   Johnson           <All Orders for Johnson>
456   Somebody Else     <All Order for Somebody>
With this resultset you can retrieve all associated orders for a custom by looping through the outer result set and then accessing the AssociatedOrders column as a new recordset that you can loop through as well.

All nice and easy, but most of the times not necessary.

I think a long time ago a number of articles on popular sites like 4GuysFromRolla, www.asp101.com and www.15seconds.com featured data shaping because I see it used a lot in old classic ASP sites we're maintaining. Apparently developers thought it was useful and applied it to all connections and connectionstrings without considering the consequences and without only applying where it made sense.

One additional "benefit" that datashaping gives is that it gives an accurate record count by default. For standard forward-only cursors recordsets you get -1 as the RecourdCount and you have to either manually loop through the Recordset and count (which is what RecordCount does anyway), or open the Recordset so it supports RecordCount (using adOpenStatic and adLockOptimistic if I recall correctly). Changing your connectionstring by removing data shaping may start to give you -1 as the RecordCount.

So to cut a long story short: it depends. The two main dangers I see from removing data shaping is the loss of the chapter functionality. That should be relatively easy to spot by looking for code like this:

Set mySubRecordset = myMainRecordset("SubRecordset").Value

RecordCount may be more difficult to spot as you probably have a lot of them, some related to datashaping while others may not. And showing something like:

Showing records 11 to 20 from -1

on your site below a paged resultset looks stupid, but may be a difficult bug to find.... ;)

Hope this helps. It's been a while since I worked with datashaping in ADO, but I think the above is reasonably accurate.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old August 5th, 2008, 01:35 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

BTW, what does Application("SQLServer_ConnectionString") look like?

Datashaping needs a connection string like this:

Provider=MSDataShape; Data Provider=Bla bla bla

For more info: http://www.connectionstrings.com/?carrier=sqlserver (at the bottom of the page)

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #4 (permalink)  
Old August 5th, 2008, 07:09 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Hi Imar -Thank you for your detailed reply, as alway much appriciated....

wow this app I am working on has been written by what seems like a very smart person who has coded in a way like ive never seem before. Very very modular classic ASP which almost seems like its over board. After following his code I have no idea how this ever worked:

sDataShapingConnectionString = "Provider=MSDataShape; Data " & Application("SQLServer_ConnectionString")

Good old connectionstrigns.com as always had the answer. For others who may want the string its:

sDataShapingConnectionString = "Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=yourMachineIP;Initial Catalog=theDBName;User ID=xxxx;Password=xxxx;"

After reading all about dataShaping Im not so sure I am a fan. I think a couple more queries on the page is a much easier way to get the desired records from the DB. I know queries inside loops which may also have a loop may not be best practice however within reason I would prefer this.

Thanks agaim Imar have a good day :o)





Wind is your friend
Matt
www.elitemarquees.com.au
Reply With Quote
  #5 (permalink)  
Old August 6th, 2008, 02:19 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

If Application("SQLServer_ConnectionString") contained a connection string starting with Provider that it would work, right? You would end up with something like:

"Provider=MSDataShape; Data Provider=...."

DataShaping has its use, but don't use it in case where you don't need it....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter3: Data Connection String pinponpan BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 0 June 21st, 2008 10:08 PM
data shaping... slooooow results page pshudgins Classic ASP Databases 0 June 23rd, 2005 02:01 PM
Data base connection string needed pramos.21d ADO.NET 3 March 8th, 2005 01:21 PM
Data Shaping Problem .. im stuck! jeuriks SQL Server ASP 2 March 19th, 2004 11:09 AM
Data Shaping In SQL Server 2000 nidgep SQL Server ASP 5 August 29th, 2003 03:30 PM



All times are GMT -4. The time now is 03:59 PM.


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