Click here to Skip to main content
15,888,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Experts,

I have written one program which handles some Tables containing Unicode Values.
I want to search those values by passing a Unicode Value.

What should I DO??
I have write following code, which seems to be right, but could not return any records.

Can you help..Its urgent..
I tried out various ways but dont work..

int Get_Match_Vocables(unsigned short *usFindVoc,CRecordset &recOut)
{
	
	CDatabase cn;
	CString FieldValue1,FieldValue2,FieldValue3;
	CDBVariant varvalue;
	CString sqlStr;

	CString csPwd,csUser,csServer,csDBName;
	csPwd = "SQLServer2005";
	csUser = "sa";
	csDBName = "DeccanCollege";
	csServer = "DECCANSERVER";

	cn.OpenEx(_T("DRIVER={SQL Server};Pwd="+csPwd+";Uid="+csUser +";Database="+csDBName+";Server="+csServer),CDatabase::noOdbcDialog);
	CRecordset rec(&cn);

	sqlStr = "Select * from Vocablemaster where slvid in(Select slvid from slipvocmaster where binno between 165 and 169) and (VocDescSan like N'%"+CString(usFindVoc)+"%')";
	
	rec.Open( CRecordset::forwardOnly,sqlStr,CRecordset::none);

       while(!rec.IsEOF())
	{
		rec.GetFieldValue((short)0,FieldValue1);
		rec.GetFieldValue((short)1,FieldValue2);
		rec.GetFieldValue((short)2,FieldValue3); 
		rec.MoveNext();
	}
return (int)rec.GetRecordCount() ;
}


In above code, usFindVoc is Unicode value, passed to this function.
When I checked its HEX value, it is correct which I have sent to it.

Please help .. if any mistakes then please suggest the corrections..
Thanks...

.....Victory...........
Posted
Updated 23-Jun-10 4:52am
v3

1 solution

Why you are not using _T("<your character="">") and LPCTSTR instead of unsigned short for Unicode character in the funcion arguments?
 
Share this answer
 
Comments
vijay.victory 24-Jun-10 6:29am    
Thnks for your suggestion..ButI already tried it out.
Actualy this code is in DLL and I m going to pass the Unicode parameter to this function from Delphi.
SO i have to pass it as PWORD i.e. Unsigned Short in VC.

Any Another suggestions???
Please.......

-------------------
Victory

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