Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

telerik -- supercharge your DNN websites
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Webhost4Life - $4.95 Windows Hosting
 


  Sponsors  

Meet Our Sponsors

.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Pulling my hair out - SQL escape characters
Previous Previous
 
Next Next
New Post 3/5/2008 3:57 AM
User is offline DNN Coder
22 posts
www.dnnmine.com
10th Ranked


Pulling my hair out - SQL escape characters 

Hi

I have a stored procedure (given below) :

 

CREATE PROC dbo.GetOrderList3
(
@OrderList varchar(500)
)
AS
BEGIN
SET NOCOUNT ON

DECLARE @TempList table
(
OrderID int
)

DECLARE @OrderID varchar(10), @Pos int

SET @OrderList = LTRIM(RTRIM(@OrderList))+ ','
SET @Pos = CHARINDEX(',', @OrderList, 1)

IF REPLACE(@OrderList, ',', '') <> ''
BEGIN
WHILE @Pos > 0
BEGIN
SET @OrderID = LTRIM(RTRIM(LEFT(@OrderList, @Pos - 1)))
IF @OrderID <> ''
BEGIN
INSERT INTO @TempList (OrderID) VALUES (CAST(@OrderID AS int)) --Use Appropriate conversion
END
SET @OrderList = RIGHT(@OrderList, LEN(@OrderList) - @Pos)
SET @Pos = CHARINDEX(',', @OrderList, 1)

END
END

SELECT o.OrderID, CustomerID, EmployeeID, OrderDate
FROM dbo.Orders AS o
JOIN
@TempList t
ON o.OrderID = t.OrderID

END
GO

GRANT EXEC ON dbo.GetOrderList3 TO WebUser
GO
 
I cant seem to get it to work correctly within the install script. I guess I cant get the escape characters for ' right.
If I run the script using the Host -> SQL page, I can get it to work correctly.
I tried reading up about escape sequence in SQL server and doing accordingly but still no joy.
Any help greatly appreciated
Thanks

 
New Post 3/5/2008 12:59 PM
User is offline Dwayne Baldwin
514 posts
8th Ranked




Re: Pulling my hair out - SQL escape characters 
Modified By Dwayne Baldwin  on 3/5/2008 5:03:34 PM)

Try removing the comment first. Then, while you are in there, you might consider trying this:

EXEC ('SELECT OrderID,CustomerID,EmployeeID,OrderDate FROM Orders WHERE OrderId IN (' + @OrderList +')')

It should replace all that code unless you working around some weird performance issue.

I hope this helps.


Dwayne J. Baldwin
 
New Post 3/5/2008 1:53 PM
User is offline Mitch Sellers
5355 posts
www.mitchelsellers.com
3rd Ranked




Re: Pulling my hair out - SQL escape characters 

If you are having issues with the script running via the install package but it works under the SQL you want to re-save your SqlDataProvider file to use Unicode....once you do that it will work!!


-Mitchel Sellers
MCITP, MCPD, MCTS
Director of Development
IowaComputerGurus Inc.
View Mitchel Sellers's profile on LinkedIn

Visit mitchelsellers.com for DotNetNuke tutorials, modules and technical help

Custom DotNetNuke Services Available (Development, etc).

My sites are hosted with 3Essentials
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Pulling my hair out - SQL escape characters
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Easily Build DNN Solutions with XMod
XMod makes it easy to build news articles, house listings, custom feedback forms, product reviews and much more - without programming
www.DNNDev.com
Software Development and Integration with DNN
HNP Solutions focuses on the pragmatic use of technology and process to meet an organization's business objectives. HNP Solutions employs seasoned Enterprise and Solution Architects, Delivery Managers and QA & Business Leads. Our capabilities range from project assessments & recommendations, design & code reviews, to full program implementations. We also work with organizations in need of senior staff augmentation purposes in the areas of Enterprise and Solution architecture.
www.hnpsolutions.com
Willhite & Sharron Realtors
Exemplary service for your Seattle Real Estate needs. It's what you deserve from your Realtor®!
www.alkihomes.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP