Workaround when connecting MSSQL Server through OLE DB

xiaoxiao2021-03-06  108

When using the OLE DB mode to connect to the MS SQL Server, if the code page of the database is different from the local, the return value of the character will become? Or garbled, Microsoft's website said this is a bug, and Described as follows:

When you try to retrieve character data from a column with different collation than the client code page in Microsoft SQL OLE DB Provider (SQLOLEDB), you may receive question marks (??) instead of correct data when all the following conditions are true:

• a Connection is Made Against A Microsoft SQL Server 2000 Database.

Ssprop_init_autotranslate is set to

True.

Ssprop_init_autotranslate is part of the provider-specific

DBPropset_sqlserverdbinit property set.

• a column is bound to an an

OLEDB DBTYPE_WCHAR DATA TYPE IN The Bindings Structure.

My solution is to turn off automatic character conversion. Examples are as follows: (Powerbuilder)

Sqlca.dbms = 'OLE DB'

Sqlca.logid = 'sa'

Sqlca.logpass = ''

Sqlca.dbparm = "provider = 'sqloledb', datasource = 'my-server', commitondisconnect = 'no', providerstring = 'database = mydb,

AutoTranslate = no '"

转载请注明原文地址:https://www.9cbs.com/read-96429.html

New Post(0)