2011-11-21 166 views
1

我試圖使我的第一個Windows窗體應用程序。我試圖建立一個SQL連接,所以我插入了我的SQL函數,它在控制檯應用程序中完美地工作。我重新編譯了一下,但現在,我正在接收鏈接器錯誤,我不知道爲什麼。Windows窗體應用程序中的鏈接器錯誤

有人可以幫助我,我做錯了什麼?

謝謝!

誤差修改:

Error 3 error LNK2028: unresolved token (0A000023) "extern "C" short __stdcall SQLGetData(void *,unsigned short,short,void *,long,long *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 4 error LNK2028: unresolved token (0A000024) "extern "C" short __stdcall SQLFetch(void *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 5 error LNK2028: unresolved token (0A000025) "extern "C" short __stdcall SQLRowCount(void *,long *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 6 error LNK2028: unresolved token (0A000026) "extern "C" short __stdcall SQLNumResultCols(void *,short *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 7 error LNK2028: unresolved token (0A000027) "extern "C" short __stdcall SQLDisconnect(void *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 8 error LNK2028: unresolved token (0A000028) "extern "C" short __stdcall SQLFreeHandle(short,void *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 9 error LNK2028: unresolved token (0A000029) "extern "C" short __stdcall SQLExecDirectA(void *,unsigned char *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 10 error LNK2028: unresolved token (0A00002A) "extern "C" short __stdcall SQLSetStmtAttrW(void *,long,void *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 11 error LNK2028: unresolved token (0A00002B) "extern "C" short __stdcall SQLDriverConnectA(void *,struct HWND__ *,unsigned char *,short,unsigned char *,short,short *,unsigned short)" ([email protected]@[email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 12 error LNK2028: unresolved token (0A00002C) "extern "C" short __stdcall SQLSetConnectAttrW(void *,long,void *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 13 error LNK2028: unresolved token (0A00002D) "extern "C" short __stdcall SQLSetEnvAttr(void *,long,void *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 14 error LNK2028: unresolved token (0A00002E) "extern "C" short __stdcall SQLAllocHandle(short,void *,void * *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 15 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLGetData(void *,unsigned short,short,void *,long,long *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 16 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLFetch(void *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 17 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLRowCount(void *,long *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 18 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLNumResultCols(void *,short *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 19 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLDisconnect(void *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 20 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLFreeHandle(short,void *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 21 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLExecDirectA(void *,unsigned char *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 22 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLSetStmtAttrW(void *,long,void *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 23 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLDriverConnectA(void *,struct HWND__ *,unsigned char *,short,unsigned char *,short,short *,unsigned short)" ([email protected]@[email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 24 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLSetConnectAttrW(void *,long,void *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 25 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLSetEnvAttr(void *,long,void *,long)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 26 error LNK2019: unresolved external symbol "extern "C" short __stdcall SQLAllocHandle(short,void *,void * *)" ([email protected]@[email protected]) referenced in function "private: bool __clrcall Test_WindowsForm::Form1::ExecuteSQLCommand(void)" ([email protected]@[email protected]@$$FA$AAM_NXZ) Test_WindowsForm.obj

Error 27 fatal error LNK1120: 24 unresolved externals D:\testVS2008\Test_WindowsForm\Debug\Test_WindowsForm.exe

+0

如果您已經在使用.NET,爲什麼不使用[.NET的SQL設施](http://msdn.microsoft.com/zh-cn/library/system.data。sqlclient.aspx)? – ildjarn

+0

@ildjarn:你能告訴我一個例子嗎? – kampi

+0

['SqlConnection'](http://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqlconnection.aspx),[''SqlCommand'](http://msdn.microsoft.com /en-us/library/system.data.sqlclient.sqlcommand.aspx)等docs都有大量的例子... – ildjarn

回答

相關問題