Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Practices - SQL Strings
Message
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Best Practices - SQL Strings
Miscellaneous
Thread ID:
00841144
Message ID:
00841144
Views:
53
What are the best practices for fromatting a string to submit to a SQL Server? In the past I used code like the following:
Public Function sqlText(ByRef str As String) As String
On Error GoTo ErrHandler


    If IsNull(str) Or Len(str) = 0 Then
        sqlText = "''"
    Else
        sqlText = "'" & str & "'"
    End If

End Function
Is there a better way to handle this now? What about boolean and datetimes?

Thanks,

Jason
Next
Reply
Map
View

Click here to load this message in the networking platform