나는 내 VB.NET 프로젝트VB.NET 함수 반환 오류 및 출구 부
Public Function OpenMysqlCon() As MySqlConnection
Dim mMysqlconnection = New MySqlConnection()
Try
Dim strconDB As String = "server='192.168.100.2'; database='mydb';Port=3306; UID='epb'; password='hahaha'; pooling=true"
mMysqlconnection = New MySqlConnection
mMysqlconnection.ConnectionString = strconDB
mMysqlconnection.Open()
OpenMysqlCon = mMysqlconnection
Catch exceptionThatICaught As System.Exception
OpenMysqlCon = Nothing
End Try
End Function
에이 연결 기능을 가지고 있고 그러나
Private Sub frmTest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Using Con=OpenMysqlCon()
'mycode here
End Using
End Sub
처럼 내 VB 프로젝트 뭔가에있는 함수를 호출합니다 연결을 사용할 수 없으면 예외가 발생합니다.
msgbox에 connection not available at the moment, please try again later
과 같은 것을주고 예외를 피하고 함수를 사용하고 있던 서브를 종료 할 수 있습니까?
최종 하위
그것은 OpenMysqlCon입니다. 오타를 수정했습니다. 미안합니다. –