以前一直都是用的mysql数据库,不过我们学校这学期是学的sql server,于是想总结一下现在市面上用得比较多的数据库!毕竟数据库只是工具而且自己也不是朝数据库开发这方面走的,不打算写太多~所以只考虑最基本的几种操作!!
mysql
#include <WinSock2.h> #include <stdio.h> #include <mysql.h> #pragma comment(lib, "libmysql.lib") int main(int argc, char *argv[]) { MYSQL mysql; char *server = "localhost"; char *user = "root"; char *password = "Susake"; char *database = "Iso"; MYSQL_RES *resultset; MYSQL_ROW row; mysql_init(&mysql); if (!mysql_real_connect(&mysql, server, user, password, database, 0, NULL, 0)) printf("连接失败:%s\n", mysql_error(&mysql)); else printf("连接成功!\n"); mysql_real_query(&mysql, "select *from Susake where a = 1 and b = 2;", strlen("select *from Susake where a = 1 and b = 2;")); resultset = mysql_store_result(&mysql); while (row = mysql_fetch_row(resultset)) printf("%s %s\n", row[0], row[1]); return 0; }
sql server
oracle
mongodb
redis
时间: 2024-11-05 04:42:09