文字列に「許可されていない」単語のリストに含まれる単語が含まれているかどうかを確認するWebメソッドを作成しようとしています。このリストは時々更新されます。文字列から単語を抽出し、VBのデータベースに存在するかどうかを確認します
<System.Web.Services.WebMethod()> _
Public Function checkword(ByVal Id As String) As String
Dim returnValue As String = String.Empty
Dim s As String = Id
' Split string based on spaces
Dim words As String() = s.Split(New Char() {" "c})
Dim rer As Integer
Dim word As String
For Each word In words
'call class file
Dim oscar As New webfunctions
Try
'call function to check whether this word exists in database or not,
rer = oscar.chkword(word)
If rer > 0 Then
returnValue = "a"
Else
returnValue = "exists"
End If
Catch ex As Exception
returnValue = ex.Message
End Try
Next
Return returnValue
End Function
何か問題があります。これは、文字列の最初の単語を確認します。その後、何も返されません。どうか、提案はありますか?
oscar chkwordは、パラメータワードがデータベースに存在するかどうかを調べる関数です.SQL Serverがダウンしていますが、値が存在する場合は1を返し、値が存在しない場合は0を返します。値が存在しない場合は0を返します。それが存在するというよりは、この単語が許可されていないと言ってメッセージを返します**** – Ironsun
私は各単語の結果を得ることができるようにループを書く必要がありますか? – Ironsun