Home > other >  A 64 - bit Untiy3d 5.3 to access the database error problem
A 64 - bit Untiy3d 5.3 to access the database error problem

Time:09-23

According to the baidu to get some idea, say a 64 - bit error accessing MSSQL will be Unity, solving

NullReferenceException: Object reference not set to an instance of an Object
Mono. Data. Tds. Protocol. Tds70. Connect (Mono) Data) Tds. Protocol. TdsConnectionParameters connectionParameters)
Mono. Data. Tds. Protocol. Tds80. Connect (Mono) Data) Tds. Protocol. TdsConnectionParameters connectionParameters)
System. The Data. SqlClient. SqlConnection. The Open ()


NullReferenceException: Object reference not set to an instance of an Object
Mono. Data. Tds. Protocol. TdsConnectionPool. GetConnection ()
System. The Data. SqlClient. SqlConnection. The Open ()
System.Data.Com mon. DbDataAdapter. The Fill (System. Data. The DataSet DataSet, Int32 startRecord, Int32 maxRecords, System. String srcTable, IDbCommand command, CommandBehavior behaviors)
System.Data.Com mon. DbDataAdapter. The Fill (System. Data. The DataSet DataSet)
Tirger. Say () (at Assets/Scripts/Tirger cs: 100)
Tirger. Start () (at Assets/Scripts/Tirger cs: 91)


The code is as follows:
String con=@ "Password=sa; Persist Security Info=True; User ID=sa; Initial Catalog=SmelterDB_Tar; Data Source=222.222.115.11 ";
SqlConnection sc=new SqlConnection (con);

Sc. The Open ();
String SQL="select top 10 * from entity_70003";
SqlDataAdapter sda=new SqlDataAdapter (SQL, sc);
The DataSet ds=new DataSet ();
Sda. The Fill (ds);
DataTable dt=ds.Tables[0];
Foreach (DataRow row in dt. Rows)
{
Foreach (DataColumn column in dt. The Columns)
{print (row (column)); }
}
Sc. The Close ();

CodePudding user response:

Suggested to set up a server to get the db data, although unity3d claims in c # development, but the underlying or by some changes, can not direct connect database

CodePudding user response:

reference 1st floor yahle response:
suggested to set up a server to get the db data, although unity3d claims in c # development, but the underlying or by some changes, can not direct connect database


Ok, thanks, but I had a lot of baidu, can u3d can access the database, do not know why I am not

CodePudding user response:

String SQL="select top 10 * from entity_70003"; This field has a problem, do not conform to the requirements of the database query, suggested change

CodePudding user response:

U3D are based on MONO, MONO access database program sets the default is not quoted, need reference manual
  • Related