当前位置:网站首页>Unity connect to Microsoft SQLSERVER database
Unity connect to Microsoft SQLSERVER database
2022-06-12 11:21:00 【Game programming】
1. To configure Unity Environmental Science
- Unity Editor Set up Unity Frame compatibility to 4.X In the editor , You need to open the player settings ( file -> Build settings -> Player settings ). then , Under other settings , You can find the runtime and API Level

2. add to ddl
Unity Find the required... In the installation path ddl, Copy to project's Assets Under the folder D:\unity\2020.3.8f1c1\Editor\Data\MonoBleedingEdge\lib\mono\4.7-api

Copy to the project folder

2. Connection database scripting
- quote using System.Data.SqlClient; Namespace
- Write a script
void Start() { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder.DataSource = "localhost"; // update me builder.UserID = "sa"; // update me builder.Password = "123456"; // update me builder.InitialCatalog = "db_example"; string res = ""; try { using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) { connection.Open(); // READ demo string sqlStr = "select * FROM [db_example].[dbo].[tb_user];"; using (SqlCommand command = new SqlCommand(sqlStr, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { res = reader.GetInt32(0).ToString(); } } } } } catch (SqlException e) { Debug.Log(e.ToString()); } Debug.Log(res); }3. Configuration database
- Database security configuration allows remote connection with user name and password
Login status settings
Database services TCP/IP Service is open
restart SQLSERVER service
author :alwaysOnCoding
Game programming , A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
边栏推荐
- ^33 variable promotion and function promotion interview questions
- 读mysql45讲-自我总结(部分)
- Distributed storage exploration
- Golang基础(7)
- 2022-06-11:注意本文件中,graph不是邻接矩阵的含义,而是一个二部图。 在长度为N的邻接矩阵matrix中,所有的点有N个,matrix[i][j]
- (37) How bee uses different data source instances at the same time
- Common port description
- Mcuxpresso develops NXP rt1060 (3) -- porting lvgl to NXP rt1060
- FPGA key experiment
- Handwritten common interview questions
猜你喜欢
随机推荐
Clickhouse column basic data type description
人類想要擁有金錢、權力、美麗、永生、幸福……但海龜只想做一只海龜
Distributed storage exploration
Why check the @nonnull annotation at run time- Why @Nonnull annotation checked at runtime?
基于C#的安全聊天工具设计
mysql中的索引show index from XXX每个参数的意义
程序分析与优化 - 6 循环优化
MCUXpresso开发NXP RT1060(3)——移植LVGL到NXP RT1060
Pytorch笔记
(37) How bee uses different data source instances at the same time
^33 variable promotion and function promotion interview questions
AcWing 1912. Odometer (enumeration)
redis 总结
Clj3-100alh30 residual current relay
Get all listening events in the element
InfoQ geek media's 15th anniversary solicitation |position:fixed virtual button cannot take effect after being triggered. Problem analysis and Solution Exploration
InfoQ 极客传媒 15 周年庆征文|position:fixed 虚拟按键触发后无法生效问题分析及解决方案探究
Golang基础(6)
CLJ3-100ALH30剩余电流继电器
selenium使用代理IP









