当前位置:网站首页>Unity connects to the database
Unity connects to the database
2022-07-05 04:52:00 【yaohuiyaoo】
1. First, in the Assets So let's create one Plugins Folder
2. stay Plugins Put... Under the folder Mysql.Data.dll,System.Data.dll,System.Drawing.dll below
3. newly build C# Code file
open C# file , introduce using Mysql.Data.MysqlClient
Create connection objects
string s=“server=localhost;database=student;userid=root;password=root;”
MysqlConnection con=new MysqlConnection(s);
con.open();
string sql=“insert into xinxi value(“ Rage ”,888)”;
MysqlCommand msc=new MysqlCommand(sql,con);
if(msc.ExecuteNorQuery()>0){
print(“ Successful operation ”);
}
else{
print(“ operation failed ”);
}
MysqlDataReader reader=msc.ExecutReader();
while(reader.Read()){
int id=reader.GetInt(“id”);
string name=reader.GetString(“name”);
print(id+"\t"+name);
}
reader.close();
con.close();
2.count(*) Return the number of all records in the table , It is equivalent to counting all rows
count(1) Return the number of rows that are not empty
count( Name ) Returns the number of rows in the specified column , Does not contain empty records
3. Multi-table query
Internal connection :select surface . Field , surface . Field from Table name inner join Table name on Foreign keys = Primary key
Left connection :select Table name . Field , Table name . Field from Table name inner join Table name on Foreign keys = Primary key
4. Aggregate functions
count() How many lines
max() For maximum
min() For the minimum
avg() averaging
sum() Sum up
group by grouping
order by desc Descending
边栏推荐
- Difference between singleton and factory pattern
- 669. 修剪二叉搜索树 ●●
- Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
- Fluent objects and lists
- AutoCAD - continuous annotation
- AutoCAD - Zoom previous
- A survey of automatic speech recognition (ASR) research
- 54. Spiral matrix & 59 Spiral matrix II ●●
- 3dsmax scanning function point connection drawing connection line
- Detailed explanation of the ranking of the best universities
猜你喜欢

PostgreSQL 超越 MySQL,“世界上最好的编程语言”薪水偏低

CSDN body auto generate directory
![[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)](/img/92/937122b059b6f3a91ae0e0858685e7.jpg)
[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)

The 22nd Spring Festival Gala, an immersive stage for the yuan universe to shine into reality

2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem

AutoCAD - set layer

Group counting notes (1) - check code, original complement multiplication and division calculation, floating point calculation

Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?

2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem

Wenet: E2E speech recognition tool for industrial implementation
随机推荐
Séparation et combinaison de la construction du système qualité
Special information | real estate and office buildings - 22.1.9
775 Div.1 C. Tyler and strings combinatorial mathematics
[groovy] closure (closure call | closure default parameter it | code example)
SQLServer 存储过程传递数组参数
Debug insights
中国金刚烷行业研究与投资预测报告(2022版)
China as resin Market Research and investment forecast report (2022 Edition)
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
[Business Research Report] top ten trends of science and technology and it in 2022 - with download link
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
AutoCAD - continuous annotation
mysql審計日志歸檔
The first topic of ape Anthropology
Data security -- 14 -- Analysis of privacy protection governance
猿人学第一题
2022-2028 global and Chinese video coding and transcoding Market Research Report
MD5 bypass
"Measuring curve length" of CAD dream drawing
Introduce Hamming distance and calculation examples