|
Subject:
|
Help with modulizing for quicker response
|
|
Posted By:
|
topshed
|
Post Date:
|
8/4/2007 10:15:49 PM
|
My problem is I have 2000-odd pictures to show on indevidual pages and want to grab data from my online database to fill in the detail rather than typing it all in for each picture
I assume (*dangerous*) that I can create an include file to load the database. so I don't have to put in into every script.
But I then want to pass the name of the table and the query to a script and return the result back to my original script that requested it
I can write the script to find the data, my problem is passing and returning to stuff to the right program again I assume I can use <% StrURL %> so it goes back to where it was requested, it's just the nitty gritty I am having trouble with.
It would be nice if someone can point me to a script that does the same sort of thing, with the rider that I do not want to get involved with Java script.
BTW, is closing the table alright or should I close the database every time
Thanx
Topshed
|
|
Reply By:
|
dparsons
|
Reply Date:
|
8/5/2007 9:26:01 AM
|
Ok I am not sure that I understand what you are tyring to do but here goes.
First and foremost, ALWAYS explicitly close your database connections, otherwise you can wind up with memory leaks and such.
Secondly, yes you can include a file that contains methods to connect to your database, for example, say that you had a method in your include file called ConnectToDatabase on your actual page you would do something like this:
'Some code ConnectToDatabase() 'some more code
In so far as returning stuff you would need to write some sort of function, for example:
In your include file: Function doFoo(value1, value2) Dim sFooValue sFooValue = value1 + value2 doFoo = sFooValue End Function
Then on your host page: Dim sFoo sFoo = doFoo(1, 2)
hth.
=========================================================== Read this if you want to know how to get a correct reply for your question: http://www.catb.org/~esr/faqs/smart-questions.html =========================================================== Technical Editor for: Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
===========================================================
|