一个关于VB.NET的问题

来源:百度知道 编辑:UC知道 时间:2024/05/04 02:58:11
由于小弟最近才初学ASP.NET,但却遇到下面代码难题,不知道为什么整天显示什么“此命令要求异步连接。请在连接字符串中设置“Asynchronous Processing=true”。 ”

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
objConnection = New SqlConnection("Server = (local);uid=sa;pwd=;database=db;")
objConnection.Open()
objCommand = New SqlCommand("insert into user (username,userpwd) values ('" + TextBox1.Text + "','" + TextBox2.Text + "')", objConnection)
objCommand.BeginExecuteNonQuery()
End Sub

请教各位高手。

Asynchronous Processing=true
代表异步连接设置为真
你就按照他的要求设置就可以了。

VB.NET与原来的VB有很多不同,VB.NET是ADO.NET,比原来更强。
可能是因为SQL后台与应用程序前台不同步,SQL后台需要处理其他用户操作,所以必须考虑异步。