Hi there
i wanna make a query like this
SELECT * FROM accounts accounts table has 3 columns
ID
Name
Password
so i wanna get every column value in variable
like char name= column[name];
so i can cout << name ;
is there away to do it?
Hi there
i wanna make a query like this
SELECT * FROM accounts accounts table has 3 columns
ID
Name
Password
so i wanna get every column value in variable
like char name= column[name];
so i can cout << name ;
is there away to do it?
As wanted to read column values into C++ variables and suggested using a client library, the practical pattern is: run a query with a DB client, iterate the result rows, and copy each column into C++ types (std::string for text, ints for numeric columns). For MySQL use the official Connector/C++ or the native C client; both are documented and show the result-set API you need (fetch rows, check for NULLs, convert types) (Connector/C++ docs, ).
A minimal example of iterating a result set and copying columns:
unsigned int num_fields = mysql_num_fields(res);
MYSQL_ROW row;
while ((row = mysql_fetch_row(res))) {
for (unsigned int i = 0; i < num_fields; ++i) {
std::string col = row[i] ? row[i] : ""; // handle NULL
std::cout << col << ' ';
}
std::cout << '\n';
}
mysql_free_result(res); About the runtime message mentioning libmySQL.dll and "binary was not built with debug information": that simply means the DLL you loaded has no PDB (debug symbols). It is usually harmless — you can continue debugging your own code. To eliminate it you can obtain a debug build of the client library or build MySQL yourself with symbols; alternatively make sure you are linking matching bitness/debug vs release libs. See Visual Studio symbol management for details on loading symbols and troubleshooting PDBs ().
From the string you've written, I assume you're dealing with an SQL database.
If that's the case, then you may want to use some library - google "c++ sql", and you'll find a lot of libraries along with tutorials (just to name some, ADO, ODBC...).
.../libmySQL.dll', Binary was not built with debug information.
how to fix this?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.