当前位置:网站首页>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
边栏推荐
猜你喜欢
Introduction to JVM principle and process
CSDN body auto generate directory
Thinking of 2022 American College Students' mathematical modeling competition
2021-10-29
C4D simple cloth (version above R21)
Emlog博客主题模板源码简约好看响应式
AutoCAD - continuous annotation
Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]
54. Spiral matrix & 59 Spiral matrix II ●●
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
随机推荐
Create a pyGame window with a blue background
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
Leetcode 222 number of nodes of complete binary tree
2022-2028 global and Chinese virtual data storage Market Research Report
Matplotlib draws three-dimensional scatter and surface graphs
54. Spiral matrix & 59 Spiral matrix II ●●
AutoCAD - workspace settings
Flutter 小技巧之 ListView 和 PageView 的各种花式嵌套
MD5 bypass
質量體系建設之路的分分合合
MySQL audit log archiving
Solution of circular dependency
mysql審計日志歸檔
China needle coke industry development research and investment value report (2022 Edition)
介绍汉明距离及计算示例
Special information | finance, accounting, audit - 22.1.23
[PCL self study: feature9] global aligned spatial distribution (GASD) descriptor (continuously updated)
Autocad-- Real Time zoom
[Business Research Report] top ten trends of science and technology and it in 2022 - with download link
【acwing】836. Merge sets