Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 passing strings to stored procedures

Author  Topic 

Pumpkins_Man
Starting Member

20 Posts

Posted - 2002-04-04 : 21:07:59
hey guys, i've got another question for you. another basic one seeing i'm only a newbie.
i'm currently writing a forum using sql server and asp. i have a procedure that i'm passing variables to through
Request.String("variable_name")
i'm having trouble passing strings that have '," and keywords in them. i assume that i'd have to put " " marks around my string but i'm not sure how.
this is how i am currently putting the variables in:
 <%
dim dataConn, rs
set dataConn = Server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")
dataConn.Open "DSN=intranet;uid=intranet;pwd=intranet"
rs.open "exec Post " & Request.QueryString("Forum_ID") & "," & Request.QueryString("Icon_ID") & "," & Request.QueryString("Subject") & "," & Request.QueryString("Body")& "," & Request.QueryString("User_ID"), dataConn
%>


i'd be very grateful if one of you guys could give me a hand as to how i go about ficing this problem.

thanking you in advance,

bronson

http://www.users.bigpond.com/thefullmontybronty

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-04 : 21:31:30
Hi

You need to delimit strings with an apostrophe '

This makes problems when you input has an apostrophe in it already. To fix that, delimit by putting in two apostrphes.



sTitle = request("forum_title")
sTitle = replace(sTitle, "'", "''")

sql = "myProc '" & sTitle & "'"



Hope that helps


Damian
Go to Top of Page

Pumpkins_Man
Starting Member

20 Posts

Posted - 2002-04-04 : 22:13:37
Once again Damain you are a life saver. thank you so much it worked a treat. I've now got myself a fully functional asp messageboard .
Thanks a million

http://www.users.bigpond.com/thefullmontybronty
Go to Top of Page
   

- Advertisement -