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

Array Problem

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I wanted to have this code return recordsets using array but I am having all kinds of problem with the array (txtData). It is supposed to split my data into 14. It is not doing so. Instead, it is returning blank and because it is returning blank, it is causing the code to not work.
I can't seem to figure it out.
Can someone please rewrite this withour array?
Here is the code:
<% Language=VBScript %>
<html>
<head>
<meta NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual
Studio 6.0&quot;>
</head>
<body>

<%

const ArraySep = &quot;,&quot;
Dim objConn,objCmd,objRS
Set objConn =server.CreateObject(&quot;ADODB.Connection&quot;)
Set objCmd= server.CreateObject(&quot;ADODB.Command&quot;)
Set objRs=server.CreateObject(&quot;ADODB.Recordset&quot;)

objConn.CursorLocation = 3
objConn.Open &quot;DSN=mydb;UID=scott;PWD=tiger&quot;

objRs.CursorLocation = 3
objRs.CursorType = 3
objRs.LockType = 4

dim StRaData , StData
StRaData = Request.Form(&quot;txtData&quot;) & ArraySep


StData=Request.Form(&quot;txtData&quot;)
response.write &quot;txtData=&quot; & StData & &quot;<BR><BR>&quot;
StData = Split(StData, &quot;,&quot;)
for n=0 to ubound(stData)
response.write n & &quot;=&quot; & stData(n) & &quot;<BR>&quot;
next
response.end


With objCmd
.CommandType = &H0004
.ActiveConnection = objConn
.CommandText = &quot;gt_result&quot;
.Parameters.Append .CreateParameter(&quot;P_FirstName&quot;,200, &H0002, 20, stData(0))
.Parameters.Append .CreateParameter(&quot;P_LastName&quot;,200, &H0003, 20, stData(1))
.Parameters.Append .CreateParameter(&quot;P_Email&quot;, 200,&H0002, 255, stData(2))
.Parameters.Append .CreateParameter(&quot;P_Phone&quot;, 200,&H0003, 20, stData(3))
.Parameters.Append .CreateParameter(&quot;P_Fax&quot;,200, &H0002, 20, stData(4))
.Parameters.Append .CreateParameter(&quot;P_Address1&quot;,200, &H0002, 50, stData(5))
.Parameters.Append .CreateParameter(&quot;P_Address2&quot;, 200,&H0002, 50, stData(6))
.Parameters.Append .CreateParameter(&quot;P_City&quot;,200, &H0002, 20, stData(7))
.Parameters.Append .CreateParameter(&quot;P_State&quot;,200, &H0002, 20, stData(8))
.Parameters.Append .CreateParameter(&quot;P_ZipCode&quot;, 200,&H0002, 20, stData(98))
.Parameters.Append .CreateParameter(&quot;P_Country&quot;,200, &H0002, 20, stData(10))
.Parameters.Append .CreateParameter(&quot;P_EducationDetails&quot;,200, &H0002, 20, stData(11))
.Parameters.Append .CreateParameter(&quot;P_YearExperience&quot;, 200,&H0002, 20, stData(12))
.Parameters.Append .CreateParameter(&quot;P_ExperienceDetails&quot;,200, &H0002, 20, stData(13))

End With

objRs.Open objCmd
%>


<TABLE cellSpacing=0 cellPadding=10 width=&quot;58%&quot;
border=1

align=&quot;center&quot;>

<TR>
<TD align=middle>
CV Search Result
</TD></TR>
<TR>
<% If Not objRs.EOF And objRs.BOF Then
While not objRs.Eof %>
<TR><TD><%= objRs.Fields(1).value%></TD></TR>
<TR><TD><%= objRs.Fields(2).value%></TD></TR>
<TR><TD><%= objRs.Fields(3).value%></TD></TR>
<TR><TD><%= objRs.Fields(4).value%></TD></TR>
<TR><TD><%= objRs.Fields(5).value%></TD></TR>

<% obRs.moveNext
Wend
else
response.write stData(0) & stData(1) & stData(2) & stData(3) & stData(4) %>
<TR><TD> No Records Found...</TD></TR>
<% end if

Set objCmd=nothing
objRs.close
Set objRs=nothing
Set Conn = nothing

%>

</TR>

</TABLE>
</body>
</html>

Your help is highly appreciated.
 
No, no, I put this piece of code
for n=0 to ubound(stData)
response.write n & &quot;=&quot; & stData(n) & &quot;<BR>&quot;
next
response.end

just so I can determine what is going on with txtData.
That was how I discovered that the array method is not working.
I am looking for help in re-writing the code without array.
 
hi fengshui_1998!
I have two forms.
The first inserts records into my database.
This has 13 records ranging from txtData0 to txtData12.
I also specified maxrows =4.
Then I have another form that is supposed to retrieve records from the database and display.
This form has three input data to go with my SP which has a where_clause where firstdata = something
and second data = something
and third data = something.
Records are supposed to be retrieved based on this where_clause.
I tried using ubound but it is not working.
Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top