Chủ đề: VC++ Connect MySQL software
-
28-12-2009, 06:10 PM #1Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
VC++ Connect MySQL software
em đang muốn sử dụng hệ CSDL MYsql để làm CSDL thì cần cài thêm những thứ gì để có thể lập trình với VC++
View more random threads:
- Chạy Debug không lỗi,chạy Release lỗi
Kiểu char* ? - Hỏi hàm FindAtom để làm gì ?
- Lấy đệ quy các process con trên windows
- Dung lượng File sau khi MapViewOfFile
- Cách sử dụng rebar trong Win32 API như thế nào?
- Liệt kê các dll inject với VC++
- API GetCommandLine Tác dụng ?
- MFC đặt Con trỏ Chuột + active vào TextBox
- Cách chống chương trình bị tắt bởi taskkill?
- CreateProcess Ẩn Cửa sổ VC++
-
28-12-2009, 06:19 PM #2Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Nếu cậu lập trình C++ CLI/.NET thì Dùng ADO.NET;
Nếu cậu lập trình C++ ANSI/ISO thì dùng OBDC Component.
-
29-12-2009, 07:03 PM #3Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
em dùng ANSI thui,anh chỉ rõ hộ em OBDC Component là bao gồm những thứ gì không,cho em xin cái tên phần mềm [IMG]images/smilies/biggrin.png[/IMG],
VD nhưđoạn code này em không tìm được file mysql.h nó nằm ở đâu( mặc dù em đã cài MYSQL ) hoặc là em chỉ cài mỗi bộ cài mà không cài phần develop cho nó,nếu anh có kinh nghiệm có thể chỉ em nên cài bộ cài để develop MYSQL không
Mã:// example file hellow/main.c #include <stdio.h> #include <mysql.h> // functions from libmysqlclient int main(int argc, char *argv[]) { int i; MYSQL *conn; // connection MYSQL_RES *result; // result of the SELECT query MYSQL_ROW row; // a record form the SELECT query // create connection to MySQL conn = mysql_init(NULL); if(mysql_real_connect( conn, "localhost", "root", "XXX", "mylibrary", 0, NULL, 0) == NULL) { fprintf(stderr, "sorry, no database connection . . . "); return 1; } // create list of all publishers and determine number // of published titles const char *sql="SELECT COUNT(titleID), publName \ FROM publishers, titles \ WHERE publishers.publID = titles.publID \ GROUP BY publishers.publID \ ORDER BY publName"; if(mysql_query(conn, sql)) { fprintf(stderr, "%s ", mysql_error(conn)); fprintf(stderr, "%s ", sql); return 1; } // process result result = mysql_store_result(conn); if(result==NULL) { if(mysql_error(conn)) fprintf(stderr, "%s ", mysql_error(conn)); else fprintf(stderr, "%s ", "unknown error "); return 1; } printf("%i records found ", (int)mysql_num_rows(result)); // loop over all data records while((row = mysql_fetch_row(result)) != NULL) { for(i=0; i < mysql_num_fields(result); i++) { if(row[i] == NULL) printf("[NULL]\t"); else printf("%s\t", row[i]); } printf(" "); } // release memory, break connection mysql_free_result(result); mysql_close(conn); return 0; }
-
30-12-2009, 10:34 AM #4Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
http://mysqlcppapi.sourceforge.net/
Nếu cậu xài mySql Library này rồi thì thôi khỏi OBDC làm gì nữa, người ta thiết kế mySQL library này dùng riêng cho MYSQL, có lẽ là rất ỗn định
Tui nghĩ link trên là Download Thữ viện và header file để cậu lập trình trên C/C++ AnSI đó, Tui chưa down thử. Chỉ kiếm giúp cậu thôi.
Còn link nữa hầu hết là dùng cho hệ điều hành Linux http://tangentsoft.net/mysql++/, nhưng tui cũng có thấy mục Visual C++ trong đó.
-
06-01-2010, 08:01 AM #5Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
đây là kết quả OK
Mã:// example file hellow/main.c#include <Windows.h>#include <stdio.h>#include <mysql.h> // functions from libmysqlclient int main(int argc, char *argv[]){ int i; MYSQL *conn; // connection MYSQL_RES *result; // result of the SELECT query MYSQL_ROW row; // a record form the SELECT query // create connection to MySQL conn = mysql_init(NULL); if(mysql_real_connect( conn, "localhost", "root", "XXX", "mylibrary", 0, NULL, 0) == NULL) { fprintf(stderr, "sorry, no database connection . . . "); return 1; } // create list of all publishers and determine number // of published titles const char *sql="SELECT COUNT(titleID), publName \[*] FROM publishers, titles \ WHERE publishers.publID = titles.publID \ GROUP BY publishers.publID \ ORDER BY publName"; if(mysql_query(conn, sql)) { fprintf(stderr, "%s ", mysql_error(conn)); fprintf(stderr, "%s ", sql); return 1; } // process result result = mysql_store_result(conn); if(result==NULL) { if(mysql_error(conn)) fprintf(stderr, "%s ", mysql_error(conn)); else fprintf(stderr, "%s ", "unknown error "); return 1; } printf("%i records found ", (int)mysql_num_rows(result)); // loop over all data records while((row = mysql_fetch_row(result)) != NULL) { for(i=0; i < mysql_num_fields(result); i++) { if(row[i] == NULL) printf("[NULL]\t"); else printf("%s\t", row[i]); } printf(" "); } // release memory, break connection mysql_free_result(result); mysql_close(conn); return 0;}
-
06-01-2010, 07:51 PM #6Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
ở đây có hướng dẫn
http://www.codeproject.com/KB/database/mysqlwrap.aspx
có điều tui thử lục tung các lib chả thấy cái mysql.h nó ở đâu cả
một số link đã down
http://mysql.phphosts.org/Downloads/...n32-vs2005.zip
http://tangentsoft.net/mysql++/relea...+-3.0.9.tar.gz
-
06-01-2010, 07:57 PM #7Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
à biết tại sao rồi,đây là nguyên nhân
http://forums.mysql.com/read.php?45,...540#msg-194540
Không chỉ dừng lại ở việc sử dụng nguyên liệu cao cấp, mỗi công trình còn được "chăm sóc" bằng 4 dịch vụ xuất sắc của Tre Nghệ. Từ việc tư vấn, thiết kế đến thi công và hoàn thiện, mọi quy trình đều...
Chất Lượng và Sáng Tạo: Kiến Trúc...