Home > Database > Mysql Tutorial > mysql-insert into语句可执行不报错就是添不进去。请大神帮忙解答

mysql-insert into语句可执行不报错就是添不进去。请大神帮忙解答

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 09:35:12
Original
1806 people have browsed it

mysqlmfc数据库

MYSQL m_sqlCon;
mysql_init(&m_sqlCon);
if(!mysql_real_connect(&m_sqlCon,"localhost","root","0412qwer","xscj",3306,NULL,0))
{AfxMessageBox(_T("数据库连接失败"));}
else
{AfxMessageBox(_T("数据库连接成功"));}

<code> string sqlstr; string str1("sas"); string str2("dfsd"); int result; sqlstr="insert into xs(XH,XM) values('"+str1+"','"+str2+"')"; result=mysql_query(&m_sqlCon,sqlstr.c_str()); if(0!=result)   mysql_close(&m_sqlCon);</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template