public Sub client() Dim tM As New System.Messaging.MessageQueue() tM.Path = ".\Private$\jk" "FORMATNAME:PUBLIC=3d3dc813-c555-4fd3-8ce0-79d5b45e0d75"与指定计算机中的消息队列建立连接, Dim newMessage As New System.Messaging.Message(TextBox1.Text)接受文本筐的t-sql语句 newMessage.Label = "This is the label"消息名字, tM.Send(newMessage)发送消息 End Sub
服务端程序:
public Sub server() Dim NewQueue As New System.Messaging.MessageQueue(".\Private$\jk")"FORMATNAME:PUBLIC=3d3dc813-c555-4fd3-8ce0-79d5b45e0d75"与指定计算机中的消息队列建立连接, Dim m As System.Messaging.Message 查看消息队列中的消息 m = NewQueue.Receive m.Formatter = New System.Messaging.XmlMessageFormatter(New String() {"System.String,mscorlib"}) Dim st As String st = m.Body消息队列中消息的消息内容。既sql语句 Dim con As New OleDb.OleDbConnection("输入自己的数据库连接字符串") con.Open() Dim com As New OleDb.OleDbCommand(st, con)执行消息中的sql语句 com.ExecuteNonQuery() con.Close() End Sub