Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Connectivity with access
Old 07-28-2007, 07:12 AM Connectivity with access
Average Talker

Posts: 16
Trades: 0
How can I connect db to access using asp?
poliedno is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-28-2007, 07:17 AM Re: Connectivity with access
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use ADO or DAO

A more specific question will get a better answer.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-28-2007, 09:36 AM Re: Connectivity with access
Average Talker

Posts: 22
Name: Keith
Location: www.improvingcode.com
Trades: 0
You can see here that someone did tests on different connection styles, but usually it boils down to using the method that the programmer is most familiar with...

Code:
Set dbaseConn = Server.CreateObject("ADODB.Connection")
dbaseConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("\db\products.mdb") & ";"
SQLQuery = "SELECT * FROM PRODUCTS"
Set RS = dbaseConn.Execute(SQLQuery)
Do While Not RS.EOF
response.write RS("name")
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
dbaseConn.Close
Set dbaseConn = Nothing
That example is a template for the way I usually do it... Borrowed from: http://faq.1and1.com/scripting_langu...atabase/2.html
__________________

Please login or register to view this content. Registration is FREE

Help me win cash, vote for my code:
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Last edited by tarponkeith; 07-28-2007 at 12:01 PM..
tarponkeith is offline
Reply With Quote
View Public Profile Visit tarponkeith's homepage!
 
Old 07-28-2007, 11:53 AM Re: Connectivity with access
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Code:
response.write RS("name")
You don't need the time stop at the end of that line.

It's also not a good idea to do a Select * query...always select the fields you want specifically, as it will take strain off of your database.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 07-28-2007, 12:02 PM Re: Connectivity with access
Average Talker

Posts: 22
Name: Keith
Location: www.improvingcode.com
Trades: 0
Quote:
Originally Posted by ADAM Web Design View Post
Code:
response.write RS("name")
You don't need the time stop at the end of that line.

It's also not a good idea to do a Select * query...always select the fields you want specifically, as it will take strain off of your database.

Thanks for the catch, I did a quick copy and paste job from the link I posted, then shorted a few extra lines, didn't notice the added %> ... Thanks, edited
__________________

Please login or register to view this content. Registration is FREE

Help me win cash, vote for my code:
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
tarponkeith is offline
Reply With Quote
View Public Profile Visit tarponkeith's homepage!
 
Old 07-28-2007, 12:44 PM Re: Connectivity with access
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
No probs, dude. You'll find that, if you make an ASP-related error in here, Hirst or I will probably catch it.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 07-28-2007, 03:04 PM Re: Connectivity with access
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Quote:
Originally Posted by ADAM Web Design View Post
It's also not a good idea to do a Select * query...always select the fields you want specifically, as it will take strain off of your database.
Is this true for Access? How would you really know? The file lives somewhere, as a file, and the application -- IIS here -- opens and works with it. It stands to reason that it's more work to grab all the fields, but I don't think that's actually the case. Since the "client" does all the work, parses the entire row to get the columns in your select list, the only savings would be sending the data from the db to the client, but with Access the client does all the work.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 07-28-2007, 05:52 PM Re: Connectivity with access
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Yes, it's true for Access as well, and the reason is what you just said...something has to figure out what fields are meant to be used. Most queries also don't require all of the fields as well, which to me is enough justification by itself.

Field specification leads to fewer issues, in other words.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 07-28-2007, 06:10 PM Re: Connectivity with access
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Quote:
Originally Posted by ADAM Web Design View Post
Field specification leads to fewer issues, in other words.
Absolutely. With ADO.NET, the fastest way to get at the data is to parse the tabular data stream directly, and access each field by it's ordinal ... go after the 4th field in the record and take the result as a string. You can refer to them by field-name instead, but this requires a lookup inside ADO to map the name of the field to its position in the TDS. If you refer to fields by the position / index number instead of their name for speed, and use *, if someone else adds a field to the middle of a table, or even to the end and your query uses a join, it's going to break your code. And any number of other reasons to only ask for what you need.

But I wonder if it's really any faster to select half the fields in an Access table instead of all of them ... and kind of doubt it. I'd still ask for the specific fields I intend to use, as a best practice, but I personally wouldn't expect any speed benefit from it.

With MySQL, Oracle, SQL Server, sending less data over the network is going to make your advice faster, on top of the other benefits. And you can measure that pretty easily with the query plans, profilers, and so on. But Access is more of a black box, a lot harder to figure out exactly what's going on inside.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 07-28-2007, 07:42 PM Re: Connectivity with access
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
In Access it is slower to use SELECT * .

The reason being that the client has to parse the columns & tables twice. Once to get the column names from the tables so they can be applied to any criteria in the query, for the conversion of the query into the p-code used for accessing the data store.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-28-2007, 08:43 PM Re: Connectivity with access
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
What Hirst said...I was going for that explanation in an awkward sort of way.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 07-29-2007, 02:03 AM Re: Connectivity with access
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
This is pretty interesting. Mind if I ask how you learned this? Microsoft white papers? I haven't used Access in a long time, and I'm working on a project that's going to allow that or SQL Server for a back-end.

I've always found Access does pretty well with just the basic optimizations, multiplexing connections and stuff like that, but without getting too aggressive, with stuff like clustered vs regular indexes, query hints, and so on. I think that's why Access doesn't support triggers and complex procs; the performance is good enough they needed more to distinguish the apps and make SQL more expensive. Anyway, optimizing for Access has been on my mind lately.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to Connectivity with access
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.50799 seconds with 12 queries