我一直在网站上查看有关字符串连接及其参数的信息。我已经实现了与此代码的连接,但我不知道如何将参数与用户输入连接起来。
这是我的代码:
Imports System
Imports System.Data
Imports System.Data.OracleClient
Module OracleConnect
Sub Main()
Dim connString As String = "server = o92; uid = java2s;password = password;"
'Create connection
Dim conn As New OracleConnection(connString)
Try
conn.Open()
Console.WriteLine("Connection Opened")
Console.WriteLine("Connection Properties")
Console.WriteLine("- ConnectionString : {0}", conn.ConnectionString)
Console.WriteLine("- ServerVersion : {0}", conn.ServerVersion)
Console.WriteLine("- State : {0}", conn.State)
Catch ex As OracleException
Console.WriteLine("Error: " & ex.ToString())
Finally
' Close Connection
conn.Close()
Console.WriteLine("Connection Closed")
End Try
End Sub
关键是我想用用户输入参数更改连接字符串,因此它将是一个文本框,服务器和密码以及侦听器将跟随用户的输入。
非常感谢