Database and MFC! HHHEEEELLLLPPPP!
-
hello! i have a dialogbased mfc program. in this programm i have several strings. CString str='Text'; now i want the string read into a access database. the table inside the database is empty, i have only 2 columns (one column for the number of the string (automatically) and the second one for the string). i use ODBC and tried this here: CMyDataBase db; db.Open(); db.m_zweiter=strText; db.Update(); db.Close(); WHAT`S WRONG? :~ can somebody help me? thanks MFC
-
hello! i have a dialogbased mfc program. in this programm i have several strings. CString str='Text'; now i want the string read into a access database. the table inside the database is empty, i have only 2 columns (one column for the number of the string (automatically) and the second one for the string). i use ODBC and tried this here: CMyDataBase db; db.Open(); db.m_zweiter=strText; db.Update(); db.Close(); WHAT`S WRONG? :~ can somebody help me? thanks MFC
Well, without seeing what's being your Open, Update, and Close functions, it's hard to say. What's your SQL statement look like, or are you trying to populate a dataset? Besides, you declare CString str and then have a ...=strText. Was that just a typo in the example? Where is the program failing? Connection strings can be complicated to set up--maybe it's the connection string you're using. Also, have you set up an ODBC data source under "Data Sources (ODBC)" usually in the control panel or adminstrative tools program groups. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
-
Well, without seeing what's being your Open, Update, and Close functions, it's hard to say. What's your SQL statement look like, or are you trying to populate a dataset? Besides, you declare CString str and then have a ...=strText. Was that just a typo in the example? Where is the program failing? Connection strings can be complicated to set up--maybe it's the connection string you're using. Also, have you set up an ODBC data source under "Data Sources (ODBC)" usually in the control panel or adminstrative tools program groups. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
hi! yes, it was a mistake. both times it must be CString strText. i tried several things, sometimes the mistake was in that row: db.m_zweiter=strText; or everything was fine, but nothing changed in the database.
-
hi! yes, it was a mistake. both times it must be CString strText. i tried several things, sometimes the mistake was in that row: db.m_zweiter=strText; or everything was fine, but nothing changed in the database.
I just read something in the help about CDaoDatabase that if you don't perform a Commit (or close all your record sets) that when you perform a Close, all pending transactions are rolled back. Maybe the same thing is true for ODBC. It's been a while since I've used ODBC. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
-
hello! i have a dialogbased mfc program. in this programm i have several strings. CString str='Text'; now i want the string read into a access database. the table inside the database is empty, i have only 2 columns (one column for the number of the string (automatically) and the second one for the string). i use ODBC and tried this here: CMyDataBase db; db.Open(); db.m_zweiter=strText; db.Update(); db.Close(); WHAT`S WRONG? :~ can somebody help me? thanks MFC
You need to do this: 1. Create a database object and open it. 2. Create a recordset object and open it. You send the SQL statement to the Recordset. 3. See CRecordset member functions for details how to insert, update and delete rows 4. You close the recordset and then the database. Best regards, Alexandru Savescu