If You're using VC++ so I recommend You to test run Your app within VC++ IDE. Then You can step through your code , line by line and check for variables if they are what You think they are. A very easy and effective way to find errors !! --------------------------------------- =d0Mi= , DCS.net [EMAIL PROTECTED] ---- Original Message ----- Date: 5-May-2002 14:44:47 +0200 From: Alexandru Coseru <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: VC++ functions for mysql > > > > Hello . > I'm a small VC++ programmer , and I have some problems with mysql c > functions. > > What I wanna do , and I don't know how, it's to get an field value from a > table and put it in a char* or into an int > > For instance , I have a small table , with two fileds > name char(50), > age int(40) > > > Another thing is to convert the number of the records into a long. > > Now , using thoose routines from the documentation: > > > > > int main() { > Connection con("my"); > char * name=new char[50]; > int age; > Query query = con.query(); > > query << "select * from mytable"; > Result res = query.store(); > > > // cout << "Records Found: " << res.size() << endl << endl; > long records=res.size() : ????? > > Row row; > Result::iterator i; > // The Result class has a read-only Random Access Iterator > for (i = res.begin(); i != res.end(); i++) { > row = *i; > strcpy(name,row["name"]; > age=row["age"]; > > // do something with name and age here.... > > } > delete name; > return 0; > } > > > > By running this example , my program crashes. > > Why ? > And how can I do it right ? > > > > > > > Thanks > Alex > Coseru > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > >
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php