RSS Forums RSS
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 27086 | Replies: 2
Reply
Join Date: Jul 2005
Posts: 41
Reputation: ohgosh is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
ohgosh's Avatar
ohgosh ohgosh is offline Offline
Light Poster

Command text was not set for the command object.

  #1  
Sep 25th, 2005
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) <- 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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2005
Posts: 41
Reputation: ohgosh is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
ohgosh's Avatar
ohgosh ohgosh is offline Offline
Light Poster

Re: Command text was not set for the command object.

  #2  
Sep 25th, 2005
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(sqlIn)
cheers,
ohgosh
Reply With Quote  
Join Date: May 2006
Posts: 1
Reputation: wardenz is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
wardenz wardenz is offline Offline
Newbie Poster

Re: Command text was not set for the command object.

  #3  
May 5th, 2006
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>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:40 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC