Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-20-2011, 03:20 PM   PM User | #1
doby48
New Coder

 
Join Date: Mar 2011
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
doby48 is an unknown quantity at this point
SQL Query Syntax

I can write SQL queries in ASP no problem but I have one that I need to run within Enterprise Manager as it will timeout if I call it from an ASP. Can someone help me with the syntax?

Code:
<%
dim strUserName

strUserName = "isisTraffic" then
	szStatement = "execute dbo.ap_DeleteDynamicResource '" + strUserName + "'"
	set conn = createobject("ADODB.Connection")
	conn.provider = "sqloledb"
	conn.connectionstring = "data source="& DB &";uid="& UID &";pwd="& PWD &";initial catalog=site_security"
	conn.open
	conn.execute(szStatement)
	conn.close
	set conn = nothing
%>
Is this just as simple as typing in the following? I am guessing I may need single or double quotes around the UserName but not quite sure.
execute dbo.ap_DeleteDynamicResource strUserName

Last edited by doby48; 12-20-2011 at 03:22 PM..
doby48 is offline   Reply With Quote
Old 12-20-2011, 09:04 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,172
Thanks: 59
Thanked 3,994 Times in 3,963 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Yes, you need the apostrophes around the user name.

If the user name itself contains an apostrophe, you need to double it.

Example:
Code:
    execute dbo.ap_DeleteDynamicResource 'O''Brien'
By the way, it would be easy to change the timeout in the ASP code to a larger value.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
doby48 (12-21-2011)
Old 12-21-2011, 04:44 AM   PM User | #3
doby48
New Coder

 
Join Date: Mar 2011
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
doby48 is an unknown quantity at this point
Perfect, worked as expected. Thank you very much! Normally increasing the timeout for the ASP would have been easy enough but because of the security layer that the responses go through and the timeout values within that layer in addition to IIS this wasnt a feasible option.
doby48 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:54 PM.


Advertisement
Log in to turn off these ads.