Odbc04Procedure.c
Dosyayı İndir
#include <windows.h>
#include <stdio.h>
#include <sqlext.h>
void main2(int argc, char *argv[])
{
HENV environment = NULL;
HDBC connection = NULL;
HSTMT statement = NULL;
UCHAR datasource[SQL_MAX_DSN_LENGTH] = "cpptest";
UCHAR userid[13] = "sa";
UCHAR password[7] = "sa";
RETCODE retcode;
SQLAllocEnv (&environment);
SQLAllocConnect (environment, &connection);
retcode = SQLConnect (connection, datasource, SQL_NTS, userid, SQL_NTS,password, SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
printf("Baglandi.\n");
SQLINTEGER article_id;
SQLINTEGER article_id_ind;
SQLCHAR article_title[50];
SQLINTEGER article_title_ind;
SQLCHAR call_delete[50]="{call DeleteArticlesByAuthorId(?)}";
SQLPrepare( statement, call_delete, sizeof(call_delete) );
SQLINTEGER author_id=3;
SQLINTEGER author_id_ind;
SQLBindParameter( statement, 1, SQL_PARAM_INPUT, SQL_C_LONG,SQL_INTEGER,7, 0,
&author_id, sizeof(author_id), &author_id_ind );
SQLExecute(statement);
long row_count;
SQLRowCount( statement, &row_count );
printf("\nSilinen sat�r say�s�: %d\n",row_count);
SQLFreeStmt (statement, SQL_DROP);
SQLDisconnect (connection);
}else{
printf("Baglanamadi.\n");
}
SQLFreeConnect (connection);
SQLFreeEnv (environment);
getch();
}
Dosyayı İndir