MySQL Forums
Forum List  »  Chinese

mysql 在c++中为什么不支持按字段名称访问数据库?
Posted by: james cao
Date: February 16, 2011 02:02AM

int f1,f2;
MYSQL_RES *res;
MYSQL_ROW row;
cstring strSql = "select field1,field2 from mytable";

mysql_query(&m_pDBConn, strSql);
res = mysql_store_result(&m_pDBConn);
row = mysql_fetch_row(res);
。。。。
在mysql 5.01的c/c++ API中为什么不能这样:
f1 = row["field1"];
f2 = row["field2"];

而必须这样呀?
f1 = row[0];
f2 = row[1];

.......

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql 在c++中为什么不支持按字段名称访问数据库?
8249
February 16, 2011 02:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.