NeverFinished
IS-IT--Management
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 "FieldName=" & FieldName & " ..... FieldValue=" & FieldValue & "<BR>"
' this would create a display of Fieldname=GP_Code ..... FieldValue=AAAAAA
' here we need to substitute the variable FieldName (named "GP_Code"
' 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?
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 "FieldName=" & FieldName & " ..... FieldValue=" & FieldValue & "<BR>"
' this would create a display of Fieldname=GP_Code ..... FieldValue=AAAAAA
' here we need to substitute the variable FieldName (named "GP_Code"
' 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?