Aleks
asked on
StringBuilder in ASP.net vs Classic ASP
Hello
I'm attempting to write a routine that loops trough all the fields from one column of a database and write out a XML
I got a friend who helped me write some pseudo-code in asp.net, but I can't find how to run this in classic asp.
Any help/suggestions? here is the code:
Sub PrepareDataForQFE()
Dim strXML as StringBuilder
{You can set up the XML as a string builder that you manually create or as an XML document – your choice, but for this example, a simple string builder can work}
Dim dtTable as DataTable
dtTable = {your query results – obviously you have to run your query}
Dim drRow as DataRow
For Each drRow in dtTable
Dim dcCol as DataColumn
For Each dcCol in drRow
strXML.Add(WriteXML(drCol. ColumnName , drCol.{Value}, {Attributes}))
Next
Next
Result = QFEBridge.CallQuik(FormIDL ist, strXML.ToString, etc.)
End Sub
Function WriteXML(strColumnName, strValue, blnReadOnly, strFormat, etc.)
{This function would write out the field part of the XML}
End Function
I'm attempting to write a routine that loops trough all the fields from one column of a database and write out a XML
I got a friend who helped me write some pseudo-code in asp.net, but I can't find how to run this in classic asp.
Any help/suggestions? here is the code:
Sub PrepareDataForQFE()
Dim strXML as StringBuilder
{You can set up the XML as a string builder that you manually create or as an XML document – your choice, but for this example, a simple string builder can work}
Dim dtTable as DataTable
dtTable = {your query results – obviously you have to run your query}
Dim drRow as DataRow
For Each drRow in dtTable
Dim dcCol as DataColumn
For Each dcCol in drRow
strXML.Add(WriteXML(drCol.
Next
Next
Result = QFEBridge.CallQuik(FormIDL
End Sub
Function WriteXML(strColumnName, strValue, blnReadOnly, strFormat, etc.)
{This function would write out the field part of the XML}
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found some weird mistakes... looks like classic ASP does not accept the "as string"
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/......../page.asp, line 297
Dim strXML As String
-----------------^
Fixed it by removing all the "as", the code ended as follows:
Sub PrepareDataForQFE()
Dim strXML
Dim dtTable
dtTable = rs_usermap
Dim drRow
For Each drRow in dtTable
Dim dcCol
For Each dcCol in drRow
strxml = strxml & WriteXML(drCol.ColumnName, drCol.Fields.Item("QFField "), "&")
Next
Next
Result = QFEBridge.CallQuik(FormIDL ist, strXML)
End Sub
Function WriteXML(strColumnName, strValue, blnReadOnly, strFormat)
End Function
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/......../page.asp, line 297
Dim strXML As String
-----------------^
Fixed it by removing all the "as", the code ended as follows:
Sub PrepareDataForQFE()
Dim strXML
Dim dtTable
dtTable = rs_usermap
Dim drRow
For Each drRow in dtTable
Dim dcCol
For Each dcCol in drRow
strxml = strxml & WriteXML(drCol.ColumnName,
Next
Next
Result = QFEBridge.CallQuik(FormIDL
End Sub
Function WriteXML(strColumnName, strValue, blnReadOnly, strFormat)
End Function
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Would this hold?