Storing images into access database along with page per records

i m developing website using asp.net with microsoft access 2003
i have product details along with the images now i want to add this images into database but how i add this pictures what code is use if there are 100 products with 100 images i want to show 10 records per page i need also code of that

you can easily upload the picture with the set html codes

the problem is that i will not give the ftp to my client so i can save path into field of access but how my client will upload all this pictures

I was only offering my advice. If you do not want it, do not use it. It is your choice. You would be false to assume I only work with SQL and not access as well as dedicated servers. I work on a lot of sites, some dedicated servers and some shared host.

I said you should avoid access, as it is far less forgiving than SQL server, especially if you do not know the tricks to keep the performance up to scratch. Regardless of how many users you get. And should your users spike for watever reason, rather be ready for it than not.

Furthermore, if a hosting company does not offer SQL server as a default option, it should not even be considered in my opinion. Unless it is not a .NET hosting provider.

So yes, access can be used for web user quite effectively. If you know how to do it. So me not noing your experience, I would suggest you just stay away from it. But it clearly seems you do, so if you want to use it as your database, go ahead.

Writing it the way you have is very good, to easily switch between databases for quick migration if needed.

But you should always save the image path into the database instead of the binary.

I am not sure I understand your last comment? Are you asking how will your users upload the image? Or are they going to FTP it up.

Compare

to

The last quote is much more meaningfull than your first one…

MS SQL Express might be free, however on shared hosting accounts you don’t have the luxury of installing it!

Then you must have your eyes closed. Just an example, a well know hosting provider:

They offer SQL Server as an Add On, which cost more than the webhosting (including Access support) itself.

And although many US hosts offer hosting packages including SQL Server, in other country’s, like where I live in the Netherlands, this isn’t the case. That’s because the prices here are much more realistic as many offers I find in the US. Many of them offer all kinds of “unlimited” packages including SQL Server for just $ 5,00 a month. The only way they can do that is by overselling their resources.

Did you ever try to connect to A SQL Server database on a shared hosted server with a company like that? When you connect remotly using SQL management Studio (Express), it takes many seconds before you’ll see the databases. Then you’ll have to look for your database among the hundreds of databases (I’ve seen even 1 hosted server with over 1000!!!). And when you do some simple performance tests, it turned out that Access was actually performing better as SQL server!!!

When “senior” developers like you talk about the advantages of SQL Server over Access, and tell people better not to use Access, they usualy talk form their own perspective, where you have a Server (or even more), writing professional websites with very large and complex database with many visitors etc. But most people, especially the ones that ask question, don’t have that luxury, they have a shared hosting account and write websites which hopefully attract many visitors, but most if them never will!!!

Also, many of those senior developers talk bad about Access, because of hearsay but never took the time to find out for themselves what Access can’t, but most important, what Access CAN do.

Regarding shared hosted environments. I never seen a website running on a shared server that needed SQL Server because of performance. There can be other reasons, for example the need to remotly connect to your database

The first bottleneck on a shared hosted server are the reources themelf, because when the amount of page-hits becomes so large that it will become an issue, the hosting company will have you move your website somewhere else, because it will use to many reources.

Upgrading to SQL Server from Access is a piece of cake if you write your code well. I’ve done this many times, it only take me approx. half an hour or so. I always use the System.Data.Common namespace instead of the OleDb or SqlClient namespace, so by just changing the connectiontring in Web.Config. I make sure that all SQL statements I write work in both Access and SQL Server. Sometimes this is not possible, then I already write 2 different statements inside an if statement, checking which provider is used. And upsizing an Access Database to SQL server is simply a matter of using the upsize wizard.

Yes, I know, I don’t use Stored Procedures and many developers will tell me I SHOULD use them. That’s a completly different discussion, I’ve seen this discussions many times, I used Stored Procedures in the past and decided that I don’t use them anymore, unless there’s a good reason to do so, but after I made that decision some 5 years ago I never found a project that would give me that reason.

  1. I would definately save the image to file, and store the path in the database instead.

  2. Unfortunately, I don’t know enough about Access to answer your question on selecting records, but I have a hunch you should look into the LIMIT sql statement. However, if this version utilizes Linq, look at the Take(x) and Skip(x) methods.

And how do you know who knows more? Although I don’t share the commonly accepted opinion that Access should better not be used in web environments (or in multi user desktop environments), doesn’t mean that I’m a beginner in .NET or (web) development.

Thank you so much. I leave the final decision to the people that hire me, I’ll advice them to use SQL Server, My SQL, Oracle or wahtever is there’s a need to. And when Access is an option also, I’ll tell them that, also telling about the possible (dis) advantages etc. but I keep an open mind to it.

I know one thing. I know more than you. And no, using SQL Server or MySQL isn’t by default a better solution to every problem…

How many people, that ask beginner question on forums like this, build web sites with 1000+ concurrent users? And performance CAN suffer with large database files, but before a database becomes large, you need to fill it wit data and I’ve seen many databases (Access, SQL Server, MySql) that are very small! I recently saw a website running with a 500 MB website, with some tables have over 1,000,000 record, running just fine with an Access backend.

Many people host small to medium sized websites on shared hosted servers, and they never even will get 1000 concurrent users (they will be glad if they have 100!, but most likely, their hosting provider starts complaining that their website is using too much resources). For this purpose, Access will do just fine. Many times, you’ll need to pay extra when you want an SQL database, sometimes the amount of SQL dataspace is limited, and the amount of databases on the SQL database server is so large that the performance is so bad that Access performance even better!

Yes, when you have a (Virtual) Dedicated server, why not install SQL Server Express (free), but many people don’t have the luxury of a (virtual) dedicated server, so their free alternative is Access, and I think, In a shared hosted environment, many times Access is the best solution.

But this is an everlasting discussing, I think it is just wrong to say in general that “Access should be avoided”. In many situtions, Access will do just fine…

Modern method would be to make a URL field and get your client a flickr account. Or just get a static hosting account somewhere for images.

Seconding the please, please don’t store images in a MSAccess DB and use them on the web. That doesn’t work so good on the desktop in a shared environment, never mind on the web.

Thanks Stalker. I was going to say something myself, but didn’t want to seem part of the huff. =/ I just tried to answer his questions as best I can.

I’ll chime in. Yes, you can use Access for the web, however it was not designed for the web, unlike SQL Server, MySQL, .ect. Those Databases had the web in mind as they matured. As previous posters said, you can use it, but if your app will be changing in the future, meaning getting bigger or more users will be using it, that will create a bottleneck that might de-rail you entire app. Which would force you to change the plumbing code for the app. It’s best to prepare for the future, rather then focus on the present.

Don’t take offence to the replys you got, these people know alot more then you, and I, know about .NET. In my mind, they offered sound advise that you should listen to. It’s all a learning process, and if someone knows more then you, you could save yourself trouble down the road by listening.

Anyways, the final decision is up to you, but I second what the other posters said. Use SQL Server Express or MySQL.

Easy dudes. No need to get in a huff. Lets just have a mature debate on advantages/disadvantages and capabilities of either technology. No need for anyone to agree. No insults or mud slinging is needed.

On that note, I have not seen a hosting company offereing .NET hosting without offering SQL Server with it. I am not saying access is not capable. Just in my mind, I would rather use the more advanced/optimized database store to save myself down the line if the site had to become big overnight.

Firstly I would recommend saving the image to disk and the path in the database. That being said, MS Access is not ideal for web use and should be avoided. Use MS SQL Express. It is free.

There will be lots of code examples on the internet of how to do paging of result sets. Google around, write some code. Then if you get stuck, post your code here and we can help you.

Thats all good and well, but at the end of the day it is not as optimized as SQL server. And the performance can suffer a lot with large database files. Knowing what your doing will help, but that would be even better in SQL. What about bigger sites with 1000+ concurrent users?

Yes, I have. Actually started my web development career building PHP apps accessing access DBs as a matter of fact. And I still have a love for Jet/Access dbs–we actually use them for lots of complex data import/export/schlepping operations. Transporting files capable of handling some internal code and referential integrity can be very useful. And you are correct inasmuch that Jet can scale pretty well with someone who knows what they are doing and how not to get in loads of trouble.

All this doesn’t change the fact that, in 2010, there are many of great free options that make it much harder to shoot yourself in the foot and corrupt the database accidentally.

Just curious if you ever tried using an Access database on the web? Because when your code is good (Open Connections as late a possible, close them as soon as possible and make sure you dispose the connection), working with Access (actually a Jet Database Engine) in a web environment can work very well. The same applies to desktop applications.

The problems with Access databases start when multiple users open connections when the application starts and use forms where tables are bound to forms. Then you’re asking for trouble in multiuser environments when users entering data in the same records at the same time. But that’s not how you should use Access or any other database for that matter. although it is temtping to build a Form quickly using the wizards, but should only be used for single user applications.

Even storing files in an access database is possible without mayor problems (I wouldn’t recommend storing large files), although you should have a good reason to do so. Note that an Access file has a size limit of 2GB, when you store many files this can become an issue, but then you can just split the tables over multiple mdb files…

I’ve seen large websites and desktop applications with many (30+) simultanious users running without any problems for years, performance is excellent.

More information on how to store files into an Access Database:

http://www.mikesdotnetting.com/Article/123

is there any free account available for image hosting