Click here to Skip to main content
16,017,037 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my code,I have retrieved the data from the database but i don't know how to insert the data into the database.


// TODO: Add your control notification handler code here

	CDatabase cd;	

	if(cd.OpenEx ("DSN=SampleData",0 ))
		MessageBox("connected");
	
	if(cd.BeginTrans ())
		MessageBox("BeginTrans");

	CRecordset rd(&cd);
	if(rd.Open (CRecordset::dynaset, _T("Select * from Sample")))
		MessageBox ("recordset opened");
	
	CString str;	
	rd.GetFieldValue("Name",str);      // Data retrived from the database.....
	MessageBox(str);
	rd.Close ();
	cd.Close ();
Posted

1 solution

 
Share this answer
 
Comments
coderDinesh 15-Jul-11 8:35am    
I can't able to get the member variables through the CRecordset object.
CPallini 15-Jul-11 8:38am    
Why?
coderDinesh 15-Jul-11 8:40am    
I don't know the problem? why it behaves like this
coderDinesh 15-Jul-11 8:43am    
Is there any function to store the data into database?
CPallini 15-Jul-11 8:46am    
There is a procedure and it is shown in the linked page. You should:
1. Call AddNew.
2. Set field appropriately.
3. Call Update

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900