Click here to Skip to main content
15,898,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DAO/ADO/ODBC Pin
Jonathan [Darka]2-Aug-06 21:21
professionalJonathan [Darka]2-Aug-06 21:21 
GeneralRe: DAO/ADO/ODBC Pin
Tara142-Aug-06 21:29
Tara142-Aug-06 21:29 
GeneralRe: DAO/ADO/ODBC Pin
Jonathan [Darka]2-Aug-06 21:31
professionalJonathan [Darka]2-Aug-06 21:31 
GeneralRe: DAO/ADO/ODBC Pin
Tara142-Aug-06 21:50
Tara142-Aug-06 21:50 
AnswerRe: DAO/ADO/ODBC Pin
Viorel.2-Aug-06 21:26
Viorel.2-Aug-06 21:26 
GeneralRe: DAO/ADO/ODBC Pin
Tara142-Aug-06 21:32
Tara142-Aug-06 21:32 
GeneralRe: DAO/ADO/ODBC [modified] Pin
Phil.Benson3-Aug-06 0:05
professionalPhil.Benson3-Aug-06 0:05 
GeneralRe: DAO/ADO/ODBC Pin
Tara143-Aug-06 1:54
Tara143-Aug-06 1:54 
Thank you. I shall try it out.

Usually what I do is read data from the database and fill the list.

void CXBudget::AddPayeeList2()
{
CDBcreate *p = new CDBcreate; // this is the class I have make to handle creating a database, adding tables, adding fields, getting value as double etc ...
	CDaoDatabase *pdB=new CDaoDatabase();
	pdB->Open(path,FALSE,FALSE,pwd);
	CString TabNam = curTableName;
	sql = ("SELECT * FROM "+TabNam+" WHERE param='budget' ORDER BY cat,payee");

	CDaoRecordset *rs;
	rs = new CDaoRecordset(pdB);
	rs->Open(AFX_DAO_USE_DEFAULT_TYPE,sql,NULL);
	CString strCategory, strPayee;
	CString strTp;
	int nFeldCount;
	nCol = 2; ;
	int nRow = 0;
	CString strRowTotal;
	
	m_XBudgetLIST_Main.DeleteAllItems(); // main list
	m_XBudgetLIST_RowTotal.DeleteAllItems();// list on the side of main list to display row total values

	nFeldCount = p->getFieldCount(pdB,strBudgetName);
	while (!rs->IsEOF()) // looping through all the rows of the database
	{
		strCategory = p->GetAsString(rs,1);
		m_XBudgetLIST_Main.InsertItem(nRow,strCategory);
		strPayee = p->GetAsString(rs,2);
		m_XBudgetLIST_Main.SetItemText(nRow,1,strPayee);
		for ( int i = 3;i<nFeldCount;i++)// looping through the columns
		{
			strTp = pCol->SetValue(p->GetAsDouble(rs,i));
			m_XBudgetLIST_Main.SetItemText(nRow,nCol,strTp);
		
			nCol++;
		}
		nCol = 2;
		strRowTotal = pCol->SetValue(Payee_RowTotal(strCategory,strPayee));
		m_XBudgetLIST_RowTotal.InsertItem(nRow,strRowTotal);
		rs->MoveNext();
		nRow++;
	}
	
	pdB->Close();
	rs->Close();
   	delete p;
	delete pdB;
	delete rs;


When the number of colunms are too many, the time for the loop to be fully executed is looong.


Fortitudine Vincimus!

GeneralRe: DAO/ADO/ODBC Pin
Phil.Benson3-Aug-06 2:17
professionalPhil.Benson3-Aug-06 2:17 
GeneralRe: DAO/ADO/ODBC Pin
Tara143-Aug-06 22:19
Tara143-Aug-06 22:19 
GeneralRe: DAO/ADO/ODBC Pin
Tara142-Aug-06 21:48
Tara142-Aug-06 21:48 
Questionget date from COleDateTime Pin
Sam_the_xalan2-Aug-06 20:21
Sam_the_xalan2-Aug-06 20:21 
AnswerRe: get date from COleDateTime Pin
Steve Echols2-Aug-06 21:12
Steve Echols2-Aug-06 21:12 
QuestionFile does not open Pin
Ratish Philip2-Aug-06 19:52
Ratish Philip2-Aug-06 19:52 
AnswerRe: File does not open Pin
Christian Graus2-Aug-06 19:58
protectorChristian Graus2-Aug-06 19:58 
AnswerRe: File does not open Pin
toxcct2-Aug-06 20:45
toxcct2-Aug-06 20:45 
AnswerRe: File does not open Pin
Sarath C2-Aug-06 21:22
Sarath C2-Aug-06 21:22 
QuestionQuestion: @ DavidCrow about NetUserGetInfo() Pin
Programm3r2-Aug-06 19:50
Programm3r2-Aug-06 19:50 
AnswerRe: Question: @ DavidCrow about NetUserGetInfo() Pin
Hamid_RT2-Aug-06 20:28
Hamid_RT2-Aug-06 20:28 
QuestionRe: Question: @ DavidCrow about NetUserGetInfo() Pin
Programm3r2-Aug-06 20:39
Programm3r2-Aug-06 20:39 
AnswerRe: Question: @ DavidCrow about NetUserGetInfo() Pin
ThatsAlok2-Aug-06 22:03
ThatsAlok2-Aug-06 22:03 
AnswerRe: Question: @ DavidCrow about NetUserGetInfo() Pin
toxcct2-Aug-06 20:43
toxcct2-Aug-06 20:43 
QuestionRe: Question: @ DavidCrow about NetUserGetInfo() Pin
Programm3r2-Aug-06 20:49
Programm3r2-Aug-06 20:49 
AnswerRe: Question: @ DavidCrow about NetUserGetInfo() Pin
toxcct2-Aug-06 20:55
toxcct2-Aug-06 20:55 
QuestionRe: Question: @ DavidCrow about NetUserGetInfo() Pin
Programm3r2-Aug-06 20:58
Programm3r2-Aug-06 20:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.