how to format input string that contains single quote?

liunx

Guest
hihi.. does anyone know how to format input string which contains single quote, before insert into database? :confused: I found information from net, giving this example:


strUserData=Quotes(request.form("T1"))
strSQLData="select Name from UserNames where Name='" & strUserData & '"

Function Quotes(strInput)
strInput=replace(strInput,"'","''")
End Function


but the input string become empty.. can anyone help me?? I'm doing asp.net with VB language.. thankssss..I'm guessing that strInput is being lost between the function call and the function itself... try putting this in.


strUserData=Quotes(request.form("T1"))
strSQLData="select Name from UserNames where Name='" & strUserData & '"

Function Quotes(ByVal strInput As String) As String
strInput=replace(strInput,"'","''")

Return strInput
End Functionyes, you are right.. thanks!! :)Cool cool... that good ol Return word thingy. Can't go wrong.
 
Back
Top