#include <sybfront.h>
#include <syberror.h>
#include <sybdb.h>
#include <stdlib.h>
#include <stdio.h>
#define DB_SERVER "******"
#define DB_USER "******"
#define DB_PWD "******"
#define DB_SOURCE "******"
#define DB_TABLE "******"
int main()
{
DBPROCESS *dbproc;
LOGINREC *login;
DBINT attachment_id;
DBINT row_number = 0;
RETCODE return_code;
if (dbinit() == FAIL)
exit(ERREXIT);
login = dblogin ();
DBSETLUSER (login, DB_USER);
DBSETLPWD (login, DB_PWD);
dbproc = dbopen(login, DB_SERVER);
dbuse(dbproc, DB_SOURCE);
dbcmd(dbproc, "select top 10 attachment_id from DB_TABLE");
dbsqlexec(dbproc);
while ((return_code = dbresults(dbproc)) != NO_MORE_RESULTS)
{
if (return_code == SUCCEED)
{
dbbind(dbproc, 1, INTBIND, (DBINT) 0, (BYTE *) &attachment_id);
while (dbnextrow(dbproc) != NO_MORE_ROWS)
{
printf ("%d\n", attachment_id);
}
}
}
dbclose (dbproc);
dbexit();
return 0;
}
No comments :
Post a Comment