我的项目无法正常运行我的应用代码
string oradb = "DATA SOURCE=192.168.1.27:1521/TEST;DBA PRIVILEGE=SYSDBA;PERSIST SECURITY INFO=True;USER ID=SYS;PASSWORD=1234";
OracleConnection conn = new OracleConnection(oradb); // C#
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO URUNLER VALUES('" + textBox1.Text.ToString() + "','" + textBox2.Text.Count() + "', '" + textBox3.Text + "','" + textBox4.Text + "')";
OracleDataAdapter adapter = new OracleDataAdapter();
adapter.InsertCommand = cmd;
conn.Dispose();
我的 app.config 代码
<connectionStrings>
<add name="OracleDbContext" connectionString="User Id=SYS;Password=1234;Data Source=192.168.1.27:1521/TEST"
providerName="Oracle.ManagedDataAccess.Client" />
<add name="WindowsFormsApplication17.Properties.Settings.ConnectionString"
connectionString="DATA SOURCE=192.168.1.27:1521/TEST;DBA PRIVILEGE=SYSDBA;PASSWORD=1234;PERSIST SECURITY INFO=True;USER ID=SYS"
providerName="Oracle.ManagedDataAccess.Client" />
和
<dataSources>
<dataSource alias="TEST" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.27)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=TEST))) "/>
</dataSources>
我的 tnsnames.ora 文件是;
LISTENER_TEST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.27)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
TEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.27)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test)
)
)
感谢您的帮助