Please do not cross-post. I got 3 copies of this message.!!! 1)- Is that a good way to use or not?
You should use common code wherever possible. However, if you really want to use the same piece of code (GetTables) for each page, then you should be putting it out into another file and putting an include statement in each page you want it in. 2)- Are there any problems to use that way especially is security? No, not that I can think of. This is server-side code and won't get to the client browser. 3)- Is there any way to pass "Tables" to another page to reduce reading from DB every time when pages are hit? No. You'll need to go back to the database for each page unless the data is very small. If it's small you could use a session variable 4)- Any more knowledgeable help will appreciated. You should not be needing to do an unqualified "select *" of all records from within any of your pages - let alone from all of them. You should only retrieve the records you need for a page. Many pages will not in fact need to read records from the database at all, but instead will update the database. I know the table you're reading is a master table containing information about the other tables. While it is possible that you might need this information in every page, I'd wonder why. What's in this master table? Dave S ----- Original Message ----- From: A. Alebreez To: [EMAIL PROTECTED] ; [email protected] ; [EMAIL PROTECTED] Sent: Sunday, September 11, 2005 10:26 AM Subject: [ASP] Experence needed Hi all, I try to build my own ASP site. I have many tables in DB one of them is the main table. This table contains all information about other tables. I write some code to minimize reading from DB everey time. So I wrote a function to return the result of query to the page invoked it similar to this: in COMMON.ASP Sub GetTables(Tables) Set Tables = Server.CreateObject("ADODB.RecordSet") Tables.Open "SELECT * FROM MT",Conn,1 End Sub At the first line of each page I wrote this code: Call GetTables(Tables) Then I used Tables as a record set. Some time I pass "Tables", i.e. a record set, as a parameter to another function in COMMON.ASP to retrieve some information. My questions are: 1)- Is that a good way to use or not? 2)- Are there any problems to use that way especially is security? 3)- Is there any way to pass "Tables" to another page to reduce reading from DB every time when pages are hit? 4)- Any more knowledgeable help will appreciated. Thanks in advance. [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- SPONSORED LINKS Active server page web hosting Active server page hosting Active server pages Active server page asp Active server page training ------------------------------------------------------------------------------ YAHOO! GROUPS LINKS a.. Visit your group "active-server-pages" on the web. b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. ------------------------------------------------------------------------------ [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/17folB/TM --------------------------------------------------------------------~-> --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
