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>

i know where the problem lies in my error yea~ cos of typo error at tt line it's complaining:

set rsIn = conn.execute(strIn)

it should be :

set rsIn = conn.execute([B]sqlIn[/B])

It should be sqlIn not strIn

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) [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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.