当前位置:网站首页>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
边栏推荐
- China as resin Market Research and investment forecast report (2022 Edition)
- Scope of package class package
- Rip notes [rip message security authentication, increase of rip interface measurement]
- SQLServer 存储过程传递数组参数
- 【acwing】240. food chain
- 2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
- Wan broadband access technology V EPON Technology
- xss注入
- 2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
- 数论函数及其求和 待更新
猜你喜欢
![[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens](/img/20/5c5550e6dabc76702f0e7ce3bef068.jpg)
[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens
![Rip notes [rip message security authentication, increase of rip interface measurement]](/img/89/f70af97676496d7b9aa867be89f11d.jpg)
Rip notes [rip message security authentication, increase of rip interface measurement]

Understand encodefloatrgba and decodefloatrgba

AutoCAD -- dimension break

AutoCAD - lengthening

次小生成树

AutoCAD - isometric annotation

Introduce Hamming distance and calculation examples
![[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)](/img/36/c4206a95c007e41df628d99e06ba18.jpg)
[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)

AutoCAD - set layer
随机推荐
XSS injection
Is $20billion a little less? Cisco is interested in Splunk?
PostgreSQL 超越 MySQL,“世界上最好的编程语言”薪水偏低
3dsmax snaps to frozen objects
Understand encodefloatrgba and decodefloatrgba
Establish cloth effect in 10 seconds
2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis
"Measuring curve length" of CAD dream drawing
Construction d'un Cluster redis sous Windows
2021 electrician cup (the 12th "China Society of electrical engineering Cup" National Undergraduate electrician mathematical modeling) detailed ideas + codes + references
AutoCAD - Zoom previous
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
A survey of automatic speech recognition (ASR) research
On-off and on-off of quality system construction
Pdf to DWG in CAD
SQLServer 存储过程传递数组参数
AutoCAD - Center zoom
2020-10-27
QT Bluetooth: a class for searching Bluetooth devices -- qbluetooth devicediscoveryagent
2021-10-29