数据库断不开?把你的代码贴出来看看。 <WebMethod(Description:="Delete one book from database by the owner of the book.", BufferResponse:=False)> _
Public Function DelBook(ByVal id As String, ByVal ip As String) As Boolean
Dim strSql As String
Dim oleDbCommand As OleDbCommand Try
conn.Open()
strSql = "delete from books where id =" & id
oleDbCommand = New OleDbCommand(strSql, conn)
oleDbCommand.ExecuteNonQuery()
Return True
Catch ex As Exception
Finally
conn.Close()
End Try
Return False
End Function
以上程序经过测试,正常断开了阿。
Public Function DelBook(ByVal id As String, ByVal ip As String) As Boolean
Dim strSql As String
Dim oleDbCommand As OleDbCommand Try
conn.Open()
strSql = "delete from books where id =" & id
oleDbCommand = New OleDbCommand(strSql, conn)
oleDbCommand.ExecuteNonQuery()
Return True
Catch ex As Exception
Finally
conn.Close()
End Try
Return False
End Function
以上程序经过测试,正常断开了阿。
比如 webservice
<WebMethod(Description:="login database BufferResponse:=False)> _
Public Function login() As Boolean
End Function <WebMethod(Description:="login database BufferResponse:=False)> _
Public Function logout() As Boolean
End Functionwinform 的名称为 form_test,还有一个button
button的代码为 :
dim lfrm_test as new form_test
lfrm_test.login
lfrm_test.logout