VBS2022でのOracle接続
準備
1.Visual Studioの「ツール」→「NuGetパッケージマネージャー」→「ソリューションのNuGetパッケージのい管理」をクリックする
2.「参照」タブをクリックし検索入力欄に「Oracle.ManagedDataAccess」と入力します。
表示されたOracle.ManagedDataAccessをクリックし、プロジェクトのチェックを入れ、インストールボタンを押します
サンプル
Imports Oracle.ManagedDataAccess.Client Module Module1 Sub Main() Dim Sql As String = "SELECT id,name,romaji FROM SYAIN" Try Using Conn As OracleConnection = New OracleConnection() Conn.ConnectionString = "User Id=hr;Password=hr;Data Source=localhost/XE;" Conn.Open() Using cmd As OracleCommand = New OracleCommand(Sql) cmd.Connection = Conn cmd.CommandType = CommandType.Text Using reader As OracleDataReader = cmd.ExecuteReader() While (reader.Read()) Console.WriteLine( reader.GetDecimal(0) & reader.GetString(1) & reader.GetString(2)) End While End Using End Using End Using Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub End Module