Created
June 10, 2012 14:01
-
-
Save cx20/2905771 to your computer and use it in GitHub Desktop.
Hello, DB-Library World!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DBNTWIN32 | |
#include "windows.h" | |
#include <sqlfront.h> | |
#include <sqldb.h> | |
#include <stdio.h> | |
int main( int argc, char* argv[] ) | |
{ | |
DBPROCESS* dbproc; | |
LOGINREC* login; | |
char message[256]; | |
dbinit(); | |
login = dblogin(); | |
DBSETLUSER( login, "sa" ); | |
DBSETLPWD ( login, "P@ssw0rd" ); | |
dbproc = dbopen( login, "(local)" ); | |
dbcmd ( dbproc, "SELECT 'Hello, DB-Library World' AS Message"); | |
dbsqlexec ( dbproc ); | |
dbresults ( dbproc ); | |
dbbind ( dbproc, 1, NTBSTRINGBIND, (DBINT)0, message ); | |
while( dbnextrow( dbproc ) != NO_MORE_ROWS ) | |
{ | |
printf( "Message\n" ); | |
printf( "-----------------------\n" ); | |
printf( "%s\n", message ); | |
} | |
dbexit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment