准备用Win32 API和ODBC来访问数据库;
代码如下;
/*------------------------------------------------------------
win32, ODBC, by bobo, 2018-09-09
------------------------------------------------------------*/
#include <windows.h>
#include "sql.h"
#include "sqlext.h"
#include "sqltypes.h"
#include "sqlucode.h"
#include "odbcss.h"
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
#define DSNAME "testDS1"
#define DSUSERNAME "sa"
#define DSUSERPWD "123"
#pragma comment(lib, "odbc32.lib")
SQLRETURN ret;
SQLHENV henv;
SQLHDBC hdbc;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndcl