LR Access MySQL

Source: Internet
Author: User
Tags sprintf

#define MySQLServer "192.168.0.99"//mysql IP
#define MYSQLUSERNAME "root"//user Name
#define MYSQLPASSWORD "123123"//Password
#define MYSQLDB "Ultrax"//Database
#define MYSQLPORT "3306"//Port
#include "ptt_mysql.h"//h file introduced in MySql Lib
Vuser_init ()
{
return 0;
}

Action ()
{
Char chquery[128];
MYSQL *mconn;
int result;
int i,j;

Introduction of Libmysql DLLs
Lr_load_dll ("Libmysql.dll");

    mconn = Lr_mysql_connect (MySQLServer, Mysqlusername, Mysqlpassword, MySQLdb, Atoi (Mysqlport));
   //sprintf (chquery, "select Uid,email,username from pre_common_member  LIMIT 0, 3;");
    sprintf (chquery, "select Author,subject,message from Pre_forum_post WHERE subject <>" ORDER by PID DESC LIMIT 0,20 ");
   //sprintf (chquery, "delete from Pre_common_member where UID in (6,7,8,9)");
   /Execute SQL
    result=lr_mysql_query (mconn,chquery);
   //row=lr_mysql_
    if (result==0) {
         lr_output_message ("Successful Execution");
   }
    else{

Lr_error_message ("Failed execution");
}
/*
Process
*/
Lr_save_string (Row[0][0].cell, "AAA");
Lr_output_message (Lr_eval_string ("{AAA}"));
Lr_save_string (Row[1][0].cell, "BBB");
Lr_output_message (Lr_eval_string ("{BBB}"));

Lr_mysql_disconnect (Mconn);

return 0;
}

LR Access MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.