一. InfoMessage 当连接从数据源处接收到一个信息性消息时被触发.
在 SQL Server 中,允许通过 Print 命令向客户端发送消息, 这些消息不会做为错误而返回, 也不会在查询的结果之中.
范例:
Dim strConn as string = ""
Dim cn as New OleDbConnection(strConn)
AddHandler cn.InfoMessage, Addressof cn_InfoMessage
cn.Open()
With cn.CreateCommand()
.CommandText = "Print 'This test message'"
.ExecuteNonQuery()
End With
Public Sub cn_InfoMessage(ByVal Sender as Object, ByVal e as System.Data.oledb.oledbInfoMessageEventArgs)
Console.WriteLine("InfoMessage event occurred")
Console.WriteLine(vbTab & "Message received:" & e.Message)
End Sub
转载于:https://www.cnblogs.com/water.xing/archive/2005/06/11/172882.html