This is my code that i put inside Form 1....(for ur info, im using microsoft visual c++ 2010).

#pragma endregion
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{

char szDSN[256] = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=C:\Documents and Settings\user\Desktop\dbtesting.mdb";

}

i try to compile my code and here I get hundreds of errors....:icon_mad:

1>------ Build started: Project: testing2, Configuration: Debug Win32 ------
1>  testing2.cpp
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(137): error C2146: syntax error : missing ';' before identifier 'SQLHWND'
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(137): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(137): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(275): error C2146: syntax error : missing ';' before identifier 'Data1'
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(275): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(275): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(276): error C2146: syntax error : missing ';' before identifier 'Data2'
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(276): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(276): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(277): error C2146: syntax error : missing ';' before identifier 'Data3'
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(277): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(277): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(278): error C2146: syntax error : missing ';' before identifier 'Data4'
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(278): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.0a\include\sqltypes.h(278): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(592): error C2061: syntax error : identifier '__out'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(594): error C2065: '__out' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(594): error C2146: syntax error : missing ')' before identifier 'SQLHENV'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(594): warning C4229: anachronism used : modifiers on data are ignored
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(594): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(598): error C2061: syntax error : identifier '__out'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(602): error C2061: syntax error : identifier '__out'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(606): error C2061: syntax error : identifier '__inout_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(607): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(607): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(634): error C2061: syntax error : identifier '__out_bcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(635): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(635): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(641): error C2061: syntax error : identifier '__in_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(644): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(644): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(648): error C2061: syntax error : identifier '__in_ecount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(650): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(650): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(658): error C2061: syntax error : identifier '__out_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(661): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(661): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(664): error C2061: syntax error : identifier '__out_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(667): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(667): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(678): error C2061: syntax error : identifier '__out_ecount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(680): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(680): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(685): error C2061: syntax error : identifier '__in_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(687): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(687): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(711): error C2061: syntax error : identifier '__out_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(712): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(712): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(721): error C2061: syntax error : identifier '__out_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(725): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(725): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(729): error C2061: syntax error : identifier '__out_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(730): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(730): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(735): error C2061: syntax error : identifier '__out_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(736): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(736): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(739): error C2061: syntax error : identifier '__out_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(743): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(743): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(747): error C2061: syntax error : identifier '__out_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(748): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(748): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(755): error C2061: syntax error : identifier '__out_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(761): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(761): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(764): error C2061: syntax error : identifier '__out_xcount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(765): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(765): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(770): error C2061: syntax error : identifier '__out_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(771): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(771): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(773): error C2059: syntax error : 'return'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(780): error C2061: syntax error : identifier '__out_xcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(781): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(781): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(791): error C2061: syntax error : identifier '__out'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(794): error C2061: syntax error : identifier '__out_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(799): error C2061: syntax error : identifier '__in_ecount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(801): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(801): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(804): error C2061: syntax error : identifier '__in_xcount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(804): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(804): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(806): error C2065: '__in' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(806): error C2146: syntax error : missing ')' before identifier 'SQLHSTMT'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(806): warning C4229: anachronism used : modifiers on data are ignored
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(807): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(811): error C2061: syntax error : identifier '__in_bcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(812): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(812): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(821): error C2061: syntax error : identifier '__in_ecount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(823): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(823): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(828): error C2061: syntax error : identifier '__in_xcount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(828): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(828): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(834): error C2061: syntax error : identifier '__inout_bcount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(835): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(835): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(838): error C2061: syntax error : identifier '__in_bcount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(839): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(839): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(845): error C2061: syntax error : identifier '__in_xcount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(846): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(846): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(850): error C2061: syntax error : identifier '__in_xcount'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(851): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(851): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(859): error C2061: syntax error : identifier '__in_ecount_opt'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(862): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(862): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sql.h(862): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

need ur favor...im running out of idea how to solve it.....

I believe you are missing #include <windows.h> So make sure you have

#include <windows.h>  // <- first this
#include <sql.h>      // <- and then this

thanks mitrmkar...my code ok now...no more errors....:)

how to connect the c programme to ms access???????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.