Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 27086 | Replies: 2
![]() |
Hi there,
i got a question on asp recordset.. i got a page whereby i will display records from a particular table. first i will go & do a select sql command to retrieve records from database, then i check if the recordset is eof and bof then i will show "THERE IS NO RECORD" if not i will display records' values in a table.
but now if the recordset is eof and bof, i don't want to show "THERE IS NO RECORD", instead i want to insert a record to the database then i will show them out.. can i do so? i got an error stating "Command text was not set for the command object. at line 55"
i don't know where the problem lies can u guys help? Thanks~ here are my codes:
i got a question on asp recordset.. i got a page whereby i will display records from a particular table. first i will go & do a select sql command to retrieve records from database, then i check if the recordset is eof and bof then i will show "THERE IS NO RECORD" if not i will display records' values in a table.
but now if the recordset is eof and bof, i don't want to show "THERE IS NO RECORD", instead i want to insert a record to the database then i will show them out.. can i do so? i got an error stating "Command text was not set for the command object. at line 55"
i don't know where the problem lies can u guys help? Thanks~ here are my codes:
<%
sqlstr = "SELECT * FROM tblItm where custNo = '"&request.QueryString("custNo")&"'"
set rs = Conn.Execute(sqlstr)
%>
<%if rs.eof and rs.bof then
sqlIn = "insert into t_tblItm (itmGrp,itmType, custNo) values ('Default', 'Default', '"&request.QueryString("custNo")&"') "
'response.Write(sqlIn)
set rsIn = conn.execute(strIn) <- line 55
sqlstr = "SELECT * FROM t_itmGrp where custNo = '"&request.QueryString("custNo")&"'"
set rs = Conn.Execute(sqlstr)
%>
<%else%>
<tr>
<td><%=rs("priceGrp")%></td>
<td><%if rs("pricingType")="" or isNull(rs("pricingType")) then
response.Write("-")
else
response.Write(rs("pricingType"))
end if%>
</td>
</tr> cheers,
ohgosh
ohgosh
i know where the problem lies in my error yea~ cos of typo error at tt line it's complaining:
it should be :
set rsIn = conn.execute(strIn)
it should be :
set rsIn = conn.execute(sqlIn)
cheers,
ohgosh
ohgosh
•
•
Join Date: May 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
It should be sqlIn not strIn
•
•
•
•
Originally Posted by ohgosh
Hi there,
i got a question on asp recordset.. i got a page whereby i will display records from a particular table. first i will go & do a select sql command to retrieve records from database, then i check if the recordset is eof and bof then i will show "THERE IS NO RECORD" if not i will display records' values in a table.
but now if the recordset is eof and bof, i don't want to show "THERE IS NO RECORD", instead i want to insert a record to the database then i will show them out.. can i do so? i got an error stating "Command text was not set for the command object. at line 55"
i don't know where the problem lies can u guys help? Thanks~ here are my codes:
<% sqlstr = "SELECT * FROM tblItm where custNo = '"&request.QueryString("custNo")&"'" set rs = Conn.Execute(sqlstr) %> <%if rs.eof and rs.bof then sqlIn = "insert into t_tblItm (itmGrp,itmType, custNo) values ('Default', 'Default', '"&request.QueryString("custNo")&"') " 'response.Write(sqlIn) set rsIn = conn.execute(sqlIn) <- line 55 sqlstr = "SELECT * FROM t_itmGrp where custNo = '"&request.QueryString("custNo")&"'" set rs = Conn.Execute(sqlstr) %> <%else%> <tr> <td><%=rs("priceGrp")%></td> <td><%if rs("pricingType")="" or isNull(rs("pricingType")) then response.Write("-") else response.Write(rs("pricingType")) end if%> </td> </tr>
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode