Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting VB to C#
Message
 
To
16/12/2002 03:13:02
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00733240
Message ID:
00733284
Views:
22
>Hi all,
>
>Can any one offer some assistances in converting ASP(VB) to ASP.NET(C#).
>
>I have a function that I would use when doing a "search" in ASP(VB) but like most I am trying to make the leap from ASP to ASP.NET.
>
>Any help in converting the below function would be greatly appreciated.
>

Something like this should work:
Public Function Search(ByVal a As String) As String

        Dim sbSQL As System.Text.StringBuilder = New System.Text.StringBuilder()
        sbSQL.Append("SELECT * FROM Articles WHERE")
        Dim words As String

        For Each words In a.Split(" ")
            If words.Trim().Length > 0 Then
                sbSQL.Append(" ArticleTitle LIKE '%")
                sbSQL.Append(words + "%' OR ArticleKeywords LIKE '%")
                sbSQL.Append(words + "%' AND")
            End If
        Next

        Dim SQL As String
        SQL = sbSQL.ToString()
        SQL = SQL.Substring(0, SQL.Length - 5)

        Return SQL
    End Function
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform