From 290682324eceb580294c646ae3b01a09805297d5 Mon Sep 17 00:00:00 2001
From: zh_What <1445177624@qq.com>
Date: 星期二, 10 十二月 2024 15:50:03 +0800
Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/脸谱AI_0817_1202

---
 /dev/null                               |    0 
 GroupA_何敬治/Server/武尧/code/武尧_1210.txt   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 GroupA_何敬治/Server/武尧/log/日志_武尧_1210.doc |    0 
 3 files changed, 47 insertions(+), 0 deletions(-)

diff --git "a/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/code/\345\255\230\346\224\276\344\273\243\347\240\201.txt" "b/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/code/\345\255\230\346\224\276\344\273\243\347\240\201.txt"
deleted file mode 100644
index e69de29..0000000
--- "a/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/code/\345\255\230\346\224\276\344\273\243\347\240\201.txt"
+++ /dev/null
diff --git "a/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/code/\346\255\246\345\260\247_1210.txt" "b/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/code/\346\255\246\345\260\247_1210.txt"
new file mode 100644
index 0000000..d51d687
--- /dev/null
+++ "b/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/code/\346\255\246\345\260\247_1210.txt"
@@ -0,0 +1,47 @@
+#include<mysql.h>  
+#include<iostream>  
+#include<string>  
+using namespace std;
+
+const char* host = "127.0.0.1";
+const char* user = "root";
+const char* pw = "123456";
+const char* database_name = "database_test";
+const int port = 3306;
+
+typedef struct Student
+{
+	int student_id;
+	string student_name;
+	string class_id;
+}Student;
+int main()
+{
+	MYSQL* con = mysql_init(NULL);
+	//璁剧疆瀛楃缂栫爜  
+	mysql_options(con, MYSQL_SET_CHARSET_NAME, "GBK");
+
+	if (!mysql_real_connect(con, host, user, pw, database_name, port, NULL, 0))
+	{
+		fprintf(stderr, "Failed to connect to database : Error:%s\n", mysql_error(con));
+		return -1;
+	}
+
+	Student stu{ 1111, "鍚村溅绁�", "杞欢涓�鐝�" };
+
+	char sql[1024];
+	//sprintf(sql, "insert into students (student_id,student_name,class_id) values(%d,'%s','%s')",
+	//	stu.student_id, stu.student_name.c_str(), stu.class_id.c_str());
+	sprintf_s(sql, sizeof(sql), "insert into students (student_id,student_name,class_id) values(%d,'%s','%s')",
+		stu.student_id, stu.student_name.c_str(), stu.class_id.c_str());
+
+	if (mysql_query(con, sql))
+	{
+		fprintf(stderr, "Failed to insert data : Error:%s\n", mysql_error(con));
+		return -1;
+	}
+
+	mysql_close(con);
+	system("pause");
+	return 0;
+}
\ No newline at end of file
diff --git "a/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/log/\346\227\245\345\277\227_\346\255\246\345\260\247_1210.doc" "b/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/log/\346\227\245\345\277\227_\346\255\246\345\260\247_1210.doc"
new file mode 100644
index 0000000..f75a46a
--- /dev/null
+++ "b/GroupA_\344\275\225\346\225\254\346\262\273/Server/\346\255\246\345\260\247/log/\346\227\245\345\277\227_\346\255\246\345\260\247_1210.doc"
Binary files differ

--
Gitblit v1.8.0