sureshp
asked on
Small code for inserting....
Hi all,
This is a simple request.
I need a small program in C, which cam be used to insert values in the table. The database is used for this is MySQL and run this program under Linux.
So i request you to post a small C code here.
Say database name : test
table one :- fields name, age
Thanks in advance.
This is a simple request.
I need a small program in C, which cam be used to insert values in the table. The database is used for this is MySQL and run this program under Linux.
So i request you to post a small C code here.
Say database name : test
table one :- fields name, age
Thanks in advance.
For more, the C API code is distributed with MySQL. It is included in the mysqlclient library and allows C programs to access a database.
Many of the clients in the MySQL source distribution are written in C. If you are looking for examples that demonstrate how to use the C API, take a look at these clients. You can find these in the clients directory in the MySQL source distribution.
You can then adapt an example, easier than us trying to guess exactly what you need.
You can also look at the C API online at:
http://www.mysql.com/doc/en/C.html
Many of the clients in the MySQL source distribution are written in C. If you are looking for examples that demonstrate how to use the C API, take a look at these clients. You can find these in the clients directory in the MySQL source distribution.
You can then adapt an example, easier than us trying to guess exactly what you need.
You can also look at the C API online at:
http://www.mysql.com/doc/en/C.html
ASKER
gj62,
Thanks for your response.
I am new to this area. I didn't write any c program using a database connection.
So could you please post a small program (full code) that can be used to insert some values into a table. It will be more useful for me to follow.
Thanks for your help.
Thanks for your response.
I am new to this area. I didn't write any c program using a database connection.
So could you please post a small program (full code) that can be used to insert some values into a table. It will be more useful for me to follow.
Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help.
Could you pls post a complete code here?
Regards
Could you pls post a complete code here?
Regards
I need to know a bit more about exactly what you want to do to post complete code...
MYSQL mysql;
mysql_init(&mysql);
mysql_options(&mysql,MYSQL
if (!mysql_real_connect(&mysq
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",
mysql_error(&mysql));
}