Hi all,

On a database I have a table, with two columns, named as FileName and the FileType. On the table I define the data type as 'Text'. I try to add some data to it within my code as follows.

Code:
	_RecordsetPtr pRec;
	ostringstream sqlCmd;
	char chState = 'R';

	bool bState = true;	// Type handle, cmdline
	if(bState)
		chState = 'R';
	else
		chState = 'T';

	sqlCmd << "INSERT INTO tblGroupState(DiskFileName, FileState) VALUES(" << fileName << ", "
		<< chState << ")";

	try
	{
		pRec = m_pConn->Execute(sqlCmd.str().c_str(), NULL, adCmdText);

		pRec->Close();
	}
	catch(_com_error &e)
	{
		_bstr_t bstrSource(e.Source());
		_bstr_t bstrDescription(e.Description());
		printf("\n Source : %s \n Description : %s \n",(LPCSTR)bstrSource,(LPCSTR)bstrDescription);
	}
Here, m_pConn is the connection to the database and it is perfectly work. Because I used it previously.

My code gives an error, Can you guys find that where I'm going wrong with.