?
also das ist der code :
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
#define ID_LEN 35
void main(void)
{
SQLHANDLE henv;
SQLHANDLE hdbc;
SQLHANDLE hstmt;
RETCODE rc;
SQLCHAR m_Id[ID_LEN];
SQLCHAR name[ID_LEN];
char Statement[50] = {"select Vorname from Personen"};
char dsn[10] = {"C++.mdb"};
char user[5] = {""};
char pass[5] = {""};
long m_bytesRet = SQL_NTS;
rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,
(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER);
rc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
rc = SQLConnect(hdbc, (SQLCHAR *)dsn, SQL_NTS, (SQLCHAR *) user, SQL_NTS,
(SQLCHAR *) pass, SQL_NTS);
rc = SQLAllocHandle(SQL_HANDLE_STMT,hdbc,&hstmt);
rc = SQLPrepare(hstmt, (SQLCHAR *)Statement, SQL_NTS);
rc = SQLExecute(hstmt);
rc = SQLFetch(hstmt);
if (rc == SQL_NO_DATA_FOUND)
{
printf("keine daten gefunden");
SQLFreeStmt(hstmt, SQL_DROP);
SQLDisconnect(hdbc);
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);
exit(0);
}
else
{
printf ("daten gefunden");
SQLGetData(hstmt, 1, SQL_C_CHAR, m_Id, 10, &m_bytesRet);
printf ("%s", m_Id);
SQLGetData(hstmt, 1, SQL_C_CHAR, name,10, &m_bytesRet);
printf ("%s", name);
}
rc = SQLFreeStmt(hstmt, SQL_CLOSE);
rc = SQLDisconnect(hdbc);
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);
}