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(strIn) [B]<- line 55[/B]
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>