#include MYSQL *connection, conn; //MySQL¿¡ ¿¬°áÇϱâ À§ÇØ Ãß°¡ char query[2048]; //Äõ¸®¹®À» ÀúÀåÇÒ °ø°£À» ¼³Á¤ int query_stat; char buf[100]; ¼Ò½º ÆÄÀÏ CString AddTitle,AddContent; //¿¡µðÅÍÄÁÆ®·Ñ °ªÀ» ÀúÀåÇÒ º¯¼ö GetDlgItemText(IDC_EDIT1,AddTitle); //¿¡µðÅÍ ÄÁÆ®·Ñ1ÀÇ °ªÀ» ÀúÀåÇÑ´Ù GetDlgItemText(IDC_EDIT2,AddContent); //¿¡µðÅÍ ÄÁÆ®·Ñ2ÀÇ °ªÀ» ÀúÀåÇÑ´Ù CString strSql,strDate; //sql¹® ÀúÀåÇÒ º¯¼ö¿Í ³¯ÀÚ ÀúÀåÇÒ º¯¼ö COleDateTime tToday = COleDateTime::GetCurrentTime(); //ÇöÀç ³¯Â¥¸¦ °¡Á®¿Â´Ù strDate = tToday.Format(_T("%Y-%m-%d")); //CString Çü½ÄÀ¸·Î º¯°æÇÏ¿© º¯¼ö¿¡ °ªÀ» ÀúÀåÇÑ´Ù. mysql_init(&conn);//DB¿¡ ¿¬°áÇÑ´Ù. connection = mysql_real_connect(&conn, DB_HOST, DB_USER, DB_PASS, DB_NAME, 3306,(char *)NULL, 0); if(connection==NULL) { wsprintf(buf, _T("Mysql connection error : %s"), mysql_error(&conn)); AfxMessageBox(buf); } strSql = "INSERT INTO notice"; //ÇØ´ç Äõ¸®¹®À» ÀúÀåÇÑ´Ù. strSql += " VALUES (NULL, '%s', '%s','%s')"; //Ãß°¡·Î µÚ¿¡ºÎºÐÀ» ÀúÀåÇÑ´Ù. sprintf(query, strSql,strDate,AddTitle,AddContent); //query¶ó´Â º¯¼ö¿¡ strSql ±×¸®°í À§¿¡ %sºÎºÐ¿¡ strDte,....,..À»Àû¿ë query_stat=mysql_query(connection, query); //ÇØ´çÄõ¸®¹®À» ½ÇÇàÇÑ´Ù.