Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone got a macro substitution Routine like &var in Foxpro?

Status
Not open for further replies.

NeverFinished

IS-IT--Management
Aug 2, 2001
3
GB
For our ASP driven data warehouse (SQL Server) I want to build an automatic memory "scatter" routine (from a results set) and a similar "gather" function so that we can cut down the code in each save or display ASP.

Heres some code:

SrchFile="ClientSW"
SQLQuery = "Select * from " & SrchFile & " where ID=200"
cmdServer.CommandText = SQLQuery
SET SrchResults = Server.CreateObject("ADODB.Recordset")
SrchResults.Open cmdServer,,3
SrchRound=0
' here is the future Function call to scatter the memory from the results set
'TMPString=AutoScatter("fieldname")
' the code below is what would be in the AutoScatter Function

for each ocolumn in SRCHResults.Fields
FieldValue=oColumn.value
FieldName=oColumn.Name
FieldType=oColumn.Type
response.write &quot;FieldName=&quot; & FieldName & &quot; ..... FieldValue=&quot; & FieldValue & &quot;<BR>&quot;
' this would create a display of Fieldname=GP_Code ..... FieldValue=200

' here we need to substitute the variable FieldName (named &quot;GP_Code&quot;)
' in Foxpro the command would be Fieldname=oColumn.Name
' ? FieldName (giving a result of 'GP_Code')
' ? &FieldName (giving a result of '200')

' this would generate a substitution that would make a
' memory variable called 'GP_Code' which has a value of '200'

' Using the 'for-next loop' you can then automatically make variables to match the
' field names and values from the results set

' How do I get this to work with VBScript or Java?

next


' the opposite of this could also be automated (grabbing the variables and their contents)
' to generate the save routine query string.

'Any Ideas people?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top