Hi, im trying to make a dll to access a mysql server via VB6.
But im getting the following errors:
Code:
Deleting intermediate files and output files for project 'mysql - Win32 Debug'.
--------------------Configuration: mysql - Win32 Debug--------------------
Compiling...
main.cpp
c:\cplusplus projects\mysql\main.cpp(17) : error C2440: 'return' : cannot convert from 'char [17]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\cplusplus projects\mysql\main.cpp(23) : error C2440: 'return' : cannot convert from 'char [17]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\cplusplus projects\mysql\main.cpp(30) : error C2440: 'return' : cannot convert from 'char ** ' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\cplusplus projects\mysql\main.cpp(35) : error C2440: 'return' : cannot convert from 'char [18]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
mysql.dll - 4 error(s), 0 warning(s)
This is my code:
Code:
#include <winsock.h>
#include <mysql.h>
#include <stdio.h>
char connecttoserver(char *server, char *user, char *password, char *database);
char sendquery(char *query);
char fetchresult();
char closeconn();
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char connecttoserver(char *server, char *user, char *password, char *database) {
conn = mysql_init(NULL);
if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) {
return "Error connecting";
}
}
char sendquery(char *query) {
if (mysql_query(conn, query)) {
return "Error with query";
}
}
char fetchresult() {
res = mysql_use_result(conn);
while ((row = mysql_fetch_row(res)) != NULL)
return row;
}
char closeconn() {
mysql_close(conn);
return "Connection closed";
}