Archived

This topic is now archived and is closed to further replies.

demonrealms

C#/C++......mysql?

Recommended Posts

demonrealms    122
Hey, my new project requires connecting to my websites mysql database and retirveing and storing information. So I was wondering if anyone knew a good site that had good tutorials for connecting, retriving, and storing info in databases using Visual C#/C++. I''m NOT using .NET. So could you guys post some links? Thanks in advance, demonrealms

Share this post


Link to post
Share on other sites
demonrealms    122
I see in the examples hwo to connect to a local database. But what about one that's on the net? It doesn't explian(good anyway) how to connect to one. It just says
// The full format for the Connection constructor is

// Connection(cchar *db, cchar *host="",

// cchar *user="", cchar *passwd="")

// You may need to specify some of them if the database is not on

// the local machine or you database username is not the same as your

// login name, etc..

try {
Connection con("mysql_cpp_data");
Query query = con.query();
Which makes little sense to me. So could anyone put that code the way it should be to connect online?
P.S I'm getting forty errors now for some reason when I copied and pasterd the code to another project so I could play around with it. Errors here:
--------------------Configuration: mysql_connection - Win32 Debug--------------------
Linking...
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@
DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(class s
td::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)"
(?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Tidy(bool)" (?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEX_N@Z) alread
y defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Copy(unsigned int)" (?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z)
already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ) already defined in libcpd.lib(string.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::allocator<char>
const &)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ) already defined in libcpd.lib(wiostrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ) already defined in libcpd.lib(wiostrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Eos(unsigned int)" (?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z) a
lready defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAE
_NI_N@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Split(void)" (?_Split@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXXZ) alread
y defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ) already defined in libcpd.lib(string.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<cha
r,struct std::char_traits<char>,class std::allocator<char> > const &)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(char co
nst *,unsigned int)"
(?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned
int,unsigned int)"
(?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE
PBDXZ) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??6std@@YAAAV?$basic_ostream@DU?$char_
traits@D@std@@@0@AAV10@PBD@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::strstream::~strstream(void)" (??1strstream@std@@UAE@XZ) already defined in libcpd.lib(strstrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_iostream<char,struct std::char_traits<char> >::~basic_iostream<char,struct std::char_traits<char> >(void)" (??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ) alr
eady defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in
mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_iostream<char,struct std::char_traits<char> >::basic_iostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *)" (??0?$bas
ic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in libcpd.lib(ios.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::append(unsigne
d int,char)"
(?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ID@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ)
already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "protected: void __thiscall std::strstreambuf::_Init(int,char *,char *,int)" (?_Init@strstreambuf@std@@IAEXHPAD0H@Z) already defined in libcpd.lib(strstrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in libcpd.lib(locale0.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::strstreambuf::~strstreambuf(void)" (??1strstreambuf@std@@UAE@XZ) already defined in libcpd.lib(strstrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: unsigned char & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Refcnt(char const *)" (?_Refcnt@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2
@@std@@AAEAAEPBD@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: char & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator[](unsigned int)" (??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAD
I@Z) already defined in mysql_connection.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Freeze(void)" (?_Freeze@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXXZ) alre
ady defined in mysql_connection.obj
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in LIBCD.lib(memmove.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strtol already defined in LIBCD.lib(strtol.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _tolower already defined in LIBCD.lib(tolower.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: int __thiscall type_info::operator==(class type_info const &)const " (??8type_info@@QBEHABV0@@Z) already defined in LIBCD.lib(typinfo.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: int __thiscall type_info::before(class type_info const &)const " (?before@type_info@@QBEHABV1@@Z) already defined in LIBCD.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/mysql_connection.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

mysql_connection.exe - 40 error(s), 1 warning(s)


[edited by - demonrealms on October 12, 2003 11:24:28 AM]

Share this post


Link to post
Share on other sites
Ruudje    100
alas, you connect to a remote dbase by specifying the domain name or the ip address of the server, with the right account (name+pw). (same as using php, asp or whatever)

The errors are most likely caused by not linking a certain library...

Share this post


Link to post
Share on other sites