誰かが次のような理由で動作していないことを知っていますか?このasp.netコードは動作していません
Dim strPhrase As String = "'%office%'"
objStringBuilder = New StringBuilder()
objSQLConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("connString"))
objSQLCommand = New SqlCommand("select col1, col2 from table1 where phrase like @phrase", objSQLConnection)
objSQLCommand.Parameters.Add("@phrase", SqlDbType.VarChar, 255).Value = strPhrase
objSQLCommand.Connection.Open()
objSQLDataReader = objSQLCommand.ExecuteReader()
While objSQLDataReader.Read()
objStringBuilder.Append(objSQLDataReader("col1") & " - " & objSQLDataReader("col2"))
End While
objSQLDataReader.Close()
objSQLCommand.Connection.Close()
return objStringBuilder.tostring()
私はphrase
とは何を削除した場合、それが再び機能し始め、すなわち:
objStringBuilder = New StringBuilder()
objSQLConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("connString"))
objSQLCommand = New SqlCommand("select col1, col2 from table1", objSQLConnection)
objSQLCommand.Connection.Open()
objSQLDataReader = objSQLCommand.ExecuteReader()
While objSQLDataReader.Read()
objStringBuilder.Append(objSQLDataReader("col1") & " - " & objSQLDataReader("col2"))
End While
objSQLDataReader.Close()
objSQLCommand.Connection.Close()
return objStringBuilder.tostring()
私はエラーを取得していない、それだけで、空白文字列を返します。
+ 1、フォーフィギュアクラブへようこそ:D – Town