Click here to Skip to main content
15,906,285 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
try
	{
		if(m_bIsDbConnected)
		{
			m_Rs=CADORecordset(&m_Db );

			m_Edit_Id.GetWindowTextA(strID);
			m_Edit_Name.GetWindowTextA(strName);
			m_Edit_Age.GetWindowTextA(strAge);
			//m_Edit_Doj.GetWindowTextA(strDoj);
			m_Edit_Sal.GetWindowTextA(strsal);

			 UINT nCheck=m_checkBoxM.GetState();
			  if (nCheck==BST_CHECKED)
				 {
					 strGender="Male";
				 }

				UINT nCheck1=m_checkBoxFm.GetState();
			 if (nCheck1==BST_CHECKED)
				 {
					 strGender="FeMale";
				 }
			

strSql.Format("INSERT INTO Customers values(%d,'%s',%d, '%s', '%s', '%s','%s')", strID, (strName), strAge,strDoj, strsal,strGender);


			m_Rs.Open(strSql);
		}
	}
	catch(CADOException &ae)
	{
		AfxMessageBox(ae.GetErrorMessage());
	}
	// Cadd->MessageBox("inserted sucessfully");

}
Posted
Updated 22-Apr-15 18:46pm
v3
Comments
Sergey Alexandrovich Kryukov 23-Apr-15 0:50am    
What, in what line?
—SA
chandanadhikari 23-Apr-15 2:21am    
please debug the code line by line or by putting breakpoints in this code and find out which exact line is throwing the error.

1 solution

the most obvious one is your format quotes 7 elements, and you only give it 6
 
Share this answer
 
Comments
CPallini 23-Apr-15 3:25am    
5.

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