当前位置:网站首页>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 - full screen display
- The first topic of ape Anthropology
- AutoCAD - lengthening
- 669. Prune binary search tree ●●
- The difference between bundle, chunk and module
- AutoCAD - workspace settings
- On-off and on-off of quality system construction
- 【Leetcode】1352. Product of the last K numbers
- Error statuslogger log4j2 could not find a logging implementation
- mysql審計日志歸檔
猜你喜欢
C4D simple cloth (version above R21)
The remainder operation is a hash function
JVM 原理和流程简介
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
Special information | real estate and office buildings - 22.1.9
Special information | finance, accounting, audit - 22.1.23
AutoCAD - Document Management
2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
AutoCAD - full screen display
Group counting notes (1) - check code, original complement multiplication and division calculation, floating point calculation
随机推荐
AutoCAD - window zoom
【Leetcode】1352. Product of the last K numbers
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
XSS injection
Establish cloth effect in 10 seconds
Manually implement heap sorting -838 Heap sort
A survey of automatic speech recognition (ASR) research
2022 thinking of mathematical modeling a problem of American college students / analysis of 2022 American competition a problem
775 Div.1 B. integral array mathematics
AutoCAD - Document Management
AutoCAD - isometric annotation
Special information | real estate and office buildings - 22.1.9
3dsmax2018 common operations and some shortcut keys of editable polygons
SQLServer 存储过程传递数组参数
Wan broadband access technology V EPON Technology
[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)
Autocad-- dynamic zoom
Forecast report on research and investment prospects of Chinese wormwood industry (2022 Edition)
Thinking of 2022 American College Students' mathematical modeling competition
中国聚氨酯硬泡市场调研与投资预测报告(2022版)