SQL OPEN,CLOSE
COBOL
VB.NET
SQLExpressのデータベースTestに接続しオープン、クローズする。
Module Module1
Private myCNN As SqlClient.SqlConnection
Sub Main()
Try
Dim strCNN As String = "Data Source=localhost\SQLEXPRESS;" _
& "Initial Catalog=TEST;" _
& "Integrated Security=True"
myCNN = New System.Data.SqlClient.SqlConnection(strCNN)
myCNN.Open()
Console.WriteLine(myCNN.State.ToString)
myCNN.Close()
Console.WriteLine(myCNN.State.ToString)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Module
お役に立てましたか?
IT、プログラミングのランキングサイトはこちらです。
最新記事の自動受信登録はこちらです。 |
![]() |
![]() |
![]() |
![]() |
| 固定リンク







コメント