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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! Populate a table with data from a string. 1

Status
Not open for further replies.

colriver

Programmer
Oct 24, 2000
6
US
I am still fairly new to ASP Programming.
I am trying parser a string return into a table. In the code blow sReturnString will be a vbtab and vbcrlf delimited string of the formatted rows of returned information.

GetOpenRecs is a method available on my MTS dll

<%
Dim sReturnString
Dim sError
retval = MutObj. GetOpenRecs (cstr(sz GetOpenRecs String), cstr(sReturnString), cstr(sError))
%>

Return value of function = <%=retval%>
<%


retval returns a –1 or 0,
-1 represents an error,
0 represents a successful return value.
 
Try this example...
Code:
<%  Option Explicit %>
<html>
<body>
<%
 Dim sReturnString
 Dim arrRows
 Dim arrColumns
 Dim i, q

 Dim rowDel, colDel 'row Delimiter and column delimiter
 rowDel = vbCrLf
 colDel = vbTab

 sReturnString = &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot; & rowDel
 sReturnString = sReturnString & &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot; & rowDel
 sReturnString = sReturnString & &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot; & rowDel
 sReturnString = sReturnString & &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot; & rowDel
 sReturnString = sReturnString & &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot; & rowDel
 sReturnString = sReturnString & &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot; & rowDel
 sReturnString = sReturnString & &quot;This&quot; & colDel & &quot;is&quot; & colDel & &quot;a&quot; & colDel & &quot;test&quot;

 Response.Write &quot;<table border=1 width='75%' align=center>&quot;
 arrRows = Split(sReturnString,rowDel)

  For i = 0 to Ubound(arrRows)

  ReDim arrColumns(0)
  arrColumns = Split(arrRows(i),colDel)
  Response.Write &quot;<tr align=center>&quot;

  For q = 0 to UBound(arrColumns)

   Response.Write &quot;<td>&quot; & arrColumns(q) & &quot;</td>&quot;

  Next

  Response.Write &quot;</tr>&quot;

 Next

 Response.Write &quot;</table>&quot;
%>
</body>
</html>

Hope it helps,

Rob
robschultz@yahoo.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

&quot;Focus on the solution to the problem,

not the obstacles in the way.&quot;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top