Tweet
I've been programming in ASP for such a long time that sometimes I do not really value its power. Today we are going to see an extreme example: dynamic variable names. I say "extreme" because I believe that the real use of the following code might be quite rare, however in some extreme situations, we need extreme - I know I repeat myself - solutions.
We are going to use different ASP stuff: an array and the execute and eval functions. At the same time we are going to use the split function, in order to create the array.
Showing posts with label execute. Show all posts
Showing posts with label execute. Show all posts
Monday, 26 March 2012
Friday, 16 December 2011
ASP: how to create a reusable function to query databases
Tweet
Today we are going to create something probably out of the ordinary. We will create two reusable functions (with parameters) in order to query a database.
The first function will open a recordset and execute a query. It will accept 3 parameters: recordset name, connection and query string.
The second function will close the recordset. It will accept 1 parameter: recordset name.
In order to use the parametrised functions, we will benefit from the Execute() VBScript function.
So, before building the two functions, let's try to understand Execute().
Today we are going to create something probably out of the ordinary. We will create two reusable functions (with parameters) in order to query a database.
The first function will open a recordset and execute a query. It will accept 3 parameters: recordset name, connection and query string.
The second function will close the recordset. It will accept 1 parameter: recordset name.
In order to use the parametrised functions, we will benefit from the Execute() VBScript function.
So, before building the two functions, let's try to understand Execute().
Subscribe to:
Posts (Atom)