Hi can you please tell me what is the error in this code?
#include<windows.h>
#include<iostream>
#include<string>
#include<sql.h>
#include<sqlext.h>
using namespace std;
int main()
{
HENV hEnv;
HDBC hDbc;
RETCODE rc;
int iOut;
char strOut[256];
char szDSN[256] = "driver={SQL
Server};pwd={};Server={local};Database={C:\\Program Files\\Microsoft SQL
Server\\MSSQL\\Data\\person_Data.MDF}";
char* szSql = "select * from table1";
rc = SQLAllocEnv(&hEnv);
rc = SQLAllocConnect(hEnv, &hDbc);
rc = SQLDriverConnect(hDbc, NULL, (unsigned char*)szDSN,
SQL_NTS, (unsigned char*)strOut,
255, (SQLSMALLINT*)&iOut, SQL_DRIVER_NOPROMPT);
{
int ival;
char chval[128];
int ret1;
int ret2;
HSTMT hStmt;
rc = SQLAllocStmt(hDbc,&hStmt);
rc = SQLPrepare(hStmt,(unsigned char*)szSql, SQL_NTS);//1
//rc = SQLBindCol(hStmt, tab_column, tr_type, tr_value, tr_len,
len_or_ind);
rc = SQLBindCol(hStmt, 1, SQL_C_ULONG, &ival, 4, (SQLINTEGER*)& ret1);
rc = SQLBindCol(hStmt, 2, SQL_C_CHAR, chval, 128, (SQLINTEGER*)&ret2);
rc = SQLExecute(hStmt); //2
cout<< ">table:"<< endl;
while(1) //3
{
rc = SQLFetch(hStmt);
if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)break;
cout<< "{"<< ival<<"}{"<< chval<< "}"<< endl;
}
rc=SQLFreeStmt(hStmt, SQL_DROP);
}
rc = SQLDisconnect(hDbc);
rc = SQLFreeEnv(hEnv);
return 0;
}
thanx
On 3/6/07, Tyro <[EMAIL PROTECTED]> wrote:
>
> hi
> I am using vc++ 6. Din't find anything related to multithreading in the
> options.
> Does VC++ 6 support it?
>
>
> On 3/5/07, Tamas Marki <[EMAIL PROTECTED]> wrote:
> >
> > On 05 Mar 2007 07:10:49 -0800, Tyro <[EMAIL
> > PROTECTED]<knight.comp%40gmail.com>>
> > wrote:
> > > Hi i'm trying to use ADO classes
> > > but while building the project i get the following errors
> > >
> > > Linking...
> > > nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
> > > __endthreadex
> > > nafxcwd.lib(thrdcore.obj ) : error LNK2001: unresolved external symbol
> > > __beginthreadex
> > > Debug/img.exe : fatal error LNK1120: 2 unresolved externals
> > > Error executing link.exe.
> > >
> > > file1.exe - 3 error(s), 0 warning(s)
> >
> > It seems like you need to link against the multithreaded libraries.
> > Look around in your project options, you'll find the option for it
> > (you didn't specify the exact compiler).
> >
> > --
> > Tamas Marki
> >
> >
>
>
[Non-text portions of this message have been removed]