当前位置:网站首页>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
边栏推荐
- Autocad-- dynamic zoom
- AutoCAD - Document Management
- C4D simple cloth (version above R21)
- MD5绕过
- Wan broadband access technology V EPON Technology
- Is $20billion a little less? Cisco is interested in Splunk?
- QT Bluetooth: a class for searching Bluetooth devices -- qbluetooth devicediscoveryagent
- 2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
- [crampon programming] lintcode decoding Encyclopedia - 1100 strange printer
- CSDN body auto generate directory
猜你喜欢
2022-2028 global and Chinese equipment as a Service Market Research Report
CUDA Programming atomic operation atomicadd reports error err:msb3721, return code 1
质量体系建设之路的分分合合
AutoCAD - Document Management
How to choose a panoramic camera that suits you?
AutoCAD - scaling
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
【Leetcode】1352. 最后 K 个数的乘积
【acwing】836. Merge sets
Reading and visualization of DICOM, MHD and raw files in medical imaging
随机推荐
54. Spiral matrix & 59 Spiral matrix II ●●
[groovy] closure (closure as function parameter | code example)
Scope of package class package
Autocad-- dynamic zoom
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
2022-2028 global and Chinese video coding and transcoding Market Research Report
中国聚氨酯硬泡市场调研与投资预测报告(2022版)
QT Bluetooth: a class for searching Bluetooth devices -- qbluetooth devicediscoveryagent
Emlog博客主题模板源码简约好看响应式
AutoCAD - lengthening
China polyurethane rigid foam Market Research and investment forecast report (2022 Edition)
[PCL self study: feature9] global aligned spatial distribution (GASD) descriptor (continuously updated)
2022-2028 global and Chinese virtual data storage Market Research Report
The difference between bundle, chunk and module
Setting up redis cluster cluster under Windows
#775 Div.1 C. Tyler and Strings 组合数学
flutter 对象和列表
中国金刚烷行业研究与投资预测报告(2022版)
How to choose a panoramic camera that suits you?
PostgreSQL 超越 MySQL,“世界上最好的编程语言”薪水偏低