当前位置:网站首页>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
边栏推荐
- Variable category (automatic, static, register, external)
- C4D simple cloth (version above R21)
- [ideas] 2021 may day mathematical modeling competition / May Day mathematical modeling ideas + references + codes
- Thinking of 2022 American College Students' mathematical modeling competition
- 2022-2028 global and Chinese virtual data storage Market Research Report
- JMeter -- distributed pressure measurement
- Construction d'un Cluster redis sous Windows
- Wenet: E2E speech recognition tool for industrial implementation
- Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
- Pdf to DWG in CAD
猜你喜欢
2022-2028 global and Chinese virtual data storage Market Research Report
【Leetcode】1352. 最后 K 个数的乘积
2022-2028 global and Chinese equipment as a Service Market Research Report
2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem
2021 huashubei mathematical modeling idea + reference + paper
C4D simple cloth (version above R21)
AutoCAD - Document Management
Flutter tips: various fancy nesting of listview and pageview
Séparation et combinaison de la construction du système qualité
Minor spanning tree
随机推荐
中国AS树脂市场调研与投资预测报告(2022版)
LeetCode之单词搜索(回溯法求解)
Minor spanning tree
[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens
Forecast report on research and investment prospects of Chinese wormwood industry (2022 Edition)
#775 Div.1 B. Integral Array 数学
AutoCAD -- dimension break
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
Leetcode 222 number of nodes of complete binary tree
Matplotlib draws three-dimensional scatter and surface graphs
MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP
2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem
AutoCAD - Zoom previous
JMeter -- distributed pressure measurement
2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
Detailed explanation of the ranking of the best universities
中国艾草行业研究与投资前景预测报告(2022版)
2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis
2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem
中国针状焦行业发展研究与投资价值报告(2022版)