MS ODBC encoding issue

Sam Hu samhudotsamhu at gmail.com
Tue Jan 22 20:41:11 PST 2013


I've tested and the Chinese character issue really fixed!

But I have two more issues here.
1.for connect with DSNless string function provided by my 
original code as below,I can not make it to connect successfully 
with really database file.Don't now why yours works.

bool connect(string connectionString)
	{
		
		SQLCHAR connStrOut[256];
		SQLSMALLINT connStrOutLen;
		
		if(bState==false)
		{
			retCode=SQLDriverConnect(hDbc, null, 
cast(SQLCHAR*)toStringz(connectionString), SQL_NTS,
					cast(ubyte*)connStrOut, connStrOut.length, &connStrOutLen, 
SQL_DRIVER_COMPLETE);
			if((retCode != SQL_SUCCESS) && (retCode != 
SQL_SUCCESS_WITH_INFO))
			{
				
				throw new Exception(format("Erro AllocHandle with retCode: 
%d",retCode));
				SQLFreeHandle( SQL_HANDLE_DBC, hDbc );
				return false;
			}
			retCode=SQLAllocHandle(SQL_HANDLE_STMT,hDbc,&hStmt);
			if((retCode != SQL_SUCCESS) && (retCode != 
SQL_SUCCESS_WITH_INFO))
			{
				
				throw new Exception(format("Erro AllocHandle with retCode: 
%d",retCode));
				SQLDisconnect( hDbc );
				SQLFreeHandle( SQL_HANDLE_DBC, hDbc);
				return false;
			}
		}
		bState=true;
		
		
		return true;
		
	}

2.Inserting new record from windows console faile on Chinese 
characters but success on English characters.If I enter a Chinese 
character to feed the new record,the program closed (crashed I 
think) immedialtey and none row affected in the database.

Any tips would be appreciated.

Regards,
Sam


More information about the Digitalmars-d-learn mailing list