当前位置:网站首页>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
边栏推荐
- MySQL audit log archiving
- 数论函数及其求和 待更新
- AutoCAD - graphic input and output
- C4D simple cloth (version above R21)
- 775 Div.1 B. integral array mathematics
- AutoCAD - isometric annotation
- 2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
- History of web page requests
- Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
- Group counting notes (1) - check code, original complement multiplication and division calculation, floating point calculation
猜你喜欢

AutoCAD - window zoom

3dsmax snaps to frozen objects

Solutions and answers for the 2021 Shenzhen cup

Emlog blog theme template source code simple good-looking responsive

Thinking of 2022 American College Students' mathematical modeling competition

Detailed introduction of OSPF header message

Redis 排查大 key 的4种方法,优化必备

The remainder operation is a hash function

Emlog博客主题模板源码简约好看响应式

Autocad-- dynamic zoom
随机推荐
Variable category (automatic, static, register, external)
CSDN body auto generate directory
xss注入
Group counting notes (1) - check code, original complement multiplication and division calculation, floating point calculation
Reading and visualization of DICOM, MHD and raw files in medical imaging
【acwing】528. cheese
AutoCAD - workspace settings
计组笔记(1)——校验码、原补码乘除计算、浮点数计算
Special information | real estate and office buildings - 22.1.9
Difference between singleton and factory pattern
2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem
A survey of automatic speech recognition (ASR) research
How should programmers learn mathematics
mysql審計日志歸檔
Autocad-- Real Time zoom
Pdf to DWG in CAD
Scope of package class package
Emlog博客主题模板源码简约好看响应式
2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
2021 electrician Cup - high speed rail traction power supply system operation data analysis and equivalent modeling ideas + code