Link to home
Start Free TrialLog in
Avatar of arichexe
arichexe

asked on

dbbind error

I get the below error on dbbind when attempting to build the below module.  What could be causing this?

error:
Performing Custom Build Step on .\test.sc
ESQL test.sc:
Compiling...
test.cpp
c:\test\test.cpp(25) : error C2664: 'dbbind' : cannot convert parameter 5 from 'char *' to 'unsigned char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

test.sc:
#define      DBNTWIN32
#include "windows.h"
#include <sqlfront.h>
#include <sqldb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>

PDBPROCESS dbproc;
PLOGINREC login;
RETCODE result_code;

char sql_stmt[256];
char testvar[51];

void main() {
  void sqlconn();

  sqlconn();

  sprintf(sql_stmt,"SELECT testvar FROM testtable");
  dbcmd(dbproc,sql_stmt);
  dbsqlexec(dbproc);

  while ((result_code = dbresults(dbproc)) != NO_MORE_RESULTS) {
    if (result_code == SUCCEED) {
        dbbind (dbproc,1,NTBSTRINGBIND,(DBINT) 0,(char *) testvar);

        while (dbnextrow(dbproc) != NO_MORE_ROWS) {
          fprintf(stdout,"testvar: %s\n",testvar);
        }
      }
  }
}

/* sqlconn procedure */

void sqlconn() {
  if (dbinit() == (char *)NULL) {
      fprintf(stdout,"Communications layer not loaded!\n");
      return;
  }

  login = dblogin();
  DBSETLUSER(login,(char *)"testlogin");
  DBSETLAPP(login,(char *)"testapp");
  DBSETLPWD(login,(char *)"testpwd");
  DBSETLVERSION(login,DBVER60);

  if ((dbproc = dbopen(login,"testsvr")) == NULL) {
      fprintf(stdout,"dbopen failed!\n");
      return;
  }

  dbuse(dbproc,"testdb");
  fprintf(stdout,"Success!\n");

} /* end sqlconn procedure */
ASKER CERTIFIED SOLUTION
Avatar of efn
efn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial