p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 27th, 2009, 01:51 PM
Friend of Wrox
Points: 622, Level: 9
Points: 622, Level: 9 Points: 622, Level: 9 Points: 622, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default Dynamic SQL execution issue by using IE 7.0

Hello,

I have Windows Vista, and I am running IE 7.0.

In Microsoft SQL Server 2005, I created a stored procedure to be called by Classic ASP 3.0.

I am having an issue;

Stored Procedure:

-- Dynamic SQL server execution

CREATEprocedure [dbo].[usp_Product_Search_Result]
(
@product_ID int= 0,
@product_name varchar(100)=''
)
AS
Declare @strSQL varchar(5000)
Declare @strWhere varchar(5000)
SELECT @strSQL = "SELECT * FROM tblProducts WHERE 1 = 1"

select @strWhere = ""

-- Product_ID
if @product_id > 0
begin
Select @strWhere = @strWhere + " AND Product_ID = " +convert(varchar(20), @product_id)
end

-- Product Name
IFLen(@product_name)<> 0
begin
Select @strWhere = @strWhere + " AND ltrim(rtrim(product_name)) = '" + @product_name + "'"
end
select
@strSQL = @strSQL + @strWhere
Print(@strSQL)
Execute(@strSQL)


ASP:
call commandcon(con, "dbo.usp_Product_Search_Result")

iflen(trim(request(" product_id" ))) > 0 then
cmd.Parameters("@product_id") = cint(trim(request("product_id" )))
endif

Set
rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.Open cmd

==============================
It fails. If I don' t use Dynamic SQL, then it is fine.

Thank you for your help.

Mustafa
__________________
MCinar

Love all the creatures because of the creator.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old August 29th, 2009, 01:02 AM
J_P J_P is offline
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default

sounds like this is an SQL problem not an ASP problem. try posting question in SQL forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
The Following User Says Thank You to J_P For This Useful Post:
mcinar (August 29th, 2009)
  #3 (permalink)  
Old August 29th, 2009, 11:33 AM
Friend of Wrox
Points: 622, Level: 9
Points: 622, Level: 9 Points: 622, Level: 9 Points: 622, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Smile

Thanks JP.
__________________
MCinar

Love all the creatures because of the creator.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Usercontrol Issue ~Bean~ ASP.NET 2.0 Professional 2 June 5th, 2006 02:35 PM
Unsuccessfuly execution of SQL statement in VBA cindyzhou Access VBA 0 January 1st, 2006 10:58 PM
Unsuccessful execution of SQL statement within VBA cindyzhou Pro VB Databases 0 January 1st, 2006 10:55 PM
Performance Issue of Execution bjohnjebastin ASP.NET 1.0 and 1.1 Basics 1 November 14th, 2005 11:18 AM
Execution Plans and IO Statistics in SQL Server bmains ADO.NET 0 March 19th, 2004 10:40 AM



All times are GMT -4. The time now is 05:24 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc