Home > database >  C # connection tip not object references to Oracle database instance
C # connection tip not object references to Oracle database instance

Time:09-26

When debugging "ServerVersion='conn. ServerVersion' threw an exception of type 'System. InvalidOperationException'" error
 
source code is as follows:
 using System; 
Using System. Collections. Generic;
//using System. Data. OracleClient;
Using System. Linq;
Using System. The Text;
Using Oracle. DataAccess. Client;
Using System. Windows. Forms;

The namespace Text. Connect. Demo
{
Class Program
{
The static void Main (string [] args)
{
OracleConnection conn=new OracleConnection ();
String connString="Data Source=(DESCRIPTION=(ADDRESS=(TCP) PROTOCOL=(HOST=117.29.161.242) (1521) PORT=) (CONNECT_DATA=https://bbs.csdn.net/topics/(SERVER=DEDICATED) (SERVICE_NAME=GJCARREVEN))); User Id=joysv2; Password=joysv2 ";
Conn=new OracleConnection (connString);
If (conn!=null)
{
MessageBox. Show (conn. ToString ());
MessageBox. Show (connString);
}
Try
{
Conn. The Open ();
MessageBox. Show (conn. State. The ToString ());
}
The catch (Exception ex)
{
MessageBox. Show (ex. Message. The ToString ());
}
The finally
{
Conn. Close ();
}
}
}
}

CodePudding user response:

Remove the Date the connString Source=

CodePudding user response:

Prompt the DESCRIPTION is invalid field

CodePudding user response:

reference 1st floor qq646748739 response:
remove the Date the connString Source=
prompt invalid field is the DESCRIPTION

CodePudding user response:

Well, the Data Source to the Datasource
There is no space in the middle,

CodePudding user response:

Try changing the platform to the x86
  • Related