i ever use ODBC (i know, that is no argument :-D), i think it is better. but i found my mistake. i forgot: db.Open(_T( "MyDatabase" ),false, false, "ODBC;UID=sa"); thanks for your reply. :rose::rose: mfc
MFC is the Best
Posts
-
CDatabase Open -
CDatabasehello @all, i connected my mfc program and an access database with ODBC.
CDatabase db; db.Open(_T( "MyDatabase" ), FALSE, FALSE, _T( "ODBC"));
the ODBC driver of my database is called 'MyDatabase'. but when i use this code, the database is not selected. i must select it myself! what must i change to select my odbc driver from the program (i have to do nothing, after i start the program)?:~ thanks mfc -
CDatabase Openhello @all, i connected my mfc program and an access database with ODBC.
CDatabase db; db.Open(_T( "MyDatabase" ), FALSE, FALSE, _T( "ODBC"));
the ODBC driver of my database is called 'MyDatabase'. but when i use this code, the database is not selected. i must select it myself! what must i change to select my odbc driver from the program (i have to do nothing, after i start the program)? thanks mfc -
CDatabasehello @all, i connected my mfc program and an access database with ODBC.
CDatabase db; db.Open(_T( "MyDatabase" ), FALSE, FALSE, _T( "ODBC"));
the ODBC driver of my database is called 'MyDatabase'. but when i use this code, the database is not selected. i must select it myself! what must i change to select my odbc driver from the program (i have to do nothing, after i start the program)?:~ thanks mfc -
ODBC, SQL and MFCthank you very very much.....:rose::rose::rose: i tried your idea....
CDatabase db; db.Open(_T( "Datenbank" ), FALSE,FALSE, _T( "ODBC")); CRecordset rs(&db); rs.Open(CRecordset::forwardOnly ,"Select distinct xy from Mytable");
i connectet access and vc++ with ODBC. the ODBC driver from my database i namend: 'Datenbank'. in my database i have different tables and one is called xy. in my code (above) must be a mistake....it doesnt work...why? :~ how can i get the strings which i read out of my database table? thank you. mfc -
ODBC, SQL and MFCi understand. my database object is derived from
CRecordset
. isn´t there a possiblity to make the sql statement: select distinct xy from mytable with a database object fromCRecordset
? Because i ever useCRecordset
....:~ thank you very much :rose: mfc -
ODBC, SQL and MFCokay...first the code:
CMyDatabase db; db.Open(); CRecordset rs (&db);
the error: 'CRecordset::CRecordset':Conversion parameter 1 from 'class CMyDatabase *' in 'class CDatabase *' not possible. what´s wrong? thanks mfc -
ODBC, SQL and MFCyes, i use angle brackets (< >).....but it does not work. why? can you help me???? the error is here
CRecordset rs(&db);
the program has problems with &db why? mfc -
ODBC, SQL and MFCthanks for reply. i tried your idea:
CMyDatabase db; db.Open(); CRecordset rs (&db);
but i get an error. must i include something (i included#include "afxdb.h"
)? thanks mfc -
ODBC, SQL and MFChello, i have an mfc program and an access database. i connected them with odbc. how can i make the following sql statement in my mfc programm? select distinct xy from mytable i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox: Now i tried this:
CMyDatabase db; db.Open( CRecordset::dynaset, _T( "Select distinct xy from mytable" ) ); db.MoveFirst(); while(!db.IsEOF()) { m_ctrlCombo.AddString(db.m_xy); db.MoveNext(); } db.Close(); UpdateData(false);
i get the error, when i want to use this funktion. the error: error with the call of a data record what´s wrong?????:~ thanks mfc -
SQL and Visual C++thanks for reply, but it does not work. somewhere i make a mistake. i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox: Now i tried this:
CMyDatabase db; db.Open( CRecordset::dynaset, _T( "Select distinct xy from mytable" ) ); db.MoveFirst(); while(!db.IsEOF()) { m_ctrlCombo.AddString(db.m_xy); db.MoveNext(); } db.Close(); UpdateData(false);
i get the error, when i want to use this funktion. the error: error with the call of a data record thanks mfc -
SQL and Visual C++hello @all, i have an mfc program and an access database. i connected them with odbc. how can i make the following sql statement in my mfc programm? 'select distinct xy from mytable' thank you very much. mfc
-
ODBC HELP WANTED!hello @all, i have an access data base and a dialogbased program. to connect the program with the data base i used odbc. then i add a new class in my project (CRecordset, name: CDatabase) and choose the table i want. finally i want to register now something into my data base. I make an object of the data base:
CDatabase db; db.Open(); db.Edit(); db.m_x=1; //(x is the column of my table) db.Update(); db.Close();
i get the error in my program, that there is no current data record. what´s wrong???? Thank you in advance. -
Database problem in vc++(ODBC)thanks for reply. what do you mean with: add new class to your project derived from CRecordset and in wizard get the table you want? :~ normaly i make it like this: i add a new class in my project (CRecordset, name: CDatabase) and choose the table i want. then i make this:
CDatabase db; db.Open(); db.Edit(); db.m_x=1; db.Update(); db.Close();
i get the error in my program, that there is no current data record. then i tried you second idea use SQL-queries db.ExecuteSQL(strSQL); but it doesn´t work, because CRecordset doesn´t know 'ExecuteSQL(...);', i think. please can you help me? -
Database problem in vc++(ODBC)hello @all, i have an access data base and a dialogbased program. to connect the program with the data base i used odbc. Then I have a CRecordset class for the data base. Finally I want to register now something into my data base. I make an object of the data base: CDatabase db; db.Open(); Now I want, that the first line of the column x has the value 1. db.m_x=1; (i tried that, but it doesn´t work) what´s wrong? Thank you in advance.
-
HELP WANTED!thanks for reply. the 'Close' is only an example.....sorry.....you are right. can you help me more? mfc
-
HELP WANTED!hello @all, i have a mdi program. in the mainframe you have for example: File -> Close i would like to hide 'Close' to the users until the correct password entered. enter password: View -> Password the 'Close' should not be gray or something like that. the user should not see that there is something like the 'Close', until he enter the right password. i hope you can help me. (please, give me an example or explain it in detail) thank you very much MFC
-
How do I make it?thanks for reply. i think i know what you mean, but i don´t know, how i should program it. can you give me an example or explain it in more detail? thank you very much mfc
-
How do I make it?hello @all, i have a mdi program. in the mainframe you have for example: File -> Close i would like to hide 'Close' to the users until the correct password entered. enter password: View -> Password the 'Close' should not be gray or something like that. the user should not see that there is something like the 'Close', until he enter the right password. i hope you can help me. thank you very much MFC
-
help......sorry i forgot: thank you very much.....great...