通过ODBC的方式连接,老是出现内存错误,无法解决。 R*?!xDJ
大家都是通过什么方式连接的呀,贴一下代码看看,我实在是没辙了,谢谢大家了 "E@A~<RKP
2sj:
&][R
E`Br# "/Bl
using (OdbcConnection odbcCon = new OdbcConnection(“DSN=Primavera SDK;UID=admin;PWD=admin”)) A;k#8&;
{ A2!pbeG
odbcCon.Open(); DVt^O[
OdbcCommand oLogCmd = odbcCon.CreateCommand(); Z<*"sFpAO
oLogCmd.CommandText = querrySql; rk47$36X
:`>tCYy;
OdbcDataReader reader = oLogCmd.ExecuteReader(); 6n|][! f
qDcoccE
f
DataTable table = new DataTable(); Jpc% i8
int fieldCount = reader.FieldCount; yMD3h$w3a
for (int i = 0; i < fieldCount; i++) 4aKppj
{ VUOe7c=
table.Columns.Add(reader.GetName(i), reader.GetFieldType(i)); nvA7eTO6C
} E.*gKfL
table.BeginLoadData(); bM2x
(E\O
object[] values = new object[fieldCount]; ,g4T>7`&U%
while (reader.Read()) EnmMFxu<
{ l](!2a=[
reader.GetValues(values); U5OFw+J
table.LoadDataRow(values, true); Z;[xaP\S
} z "z
table.EndLoadData(); RR|X4h0.
DataSet ds = new DataSet(); ^y%8_r&
ds.Tables.Add(table); ;mg.} fI
reader = null; hi4-Z=pl
oLogCmd = null; lANi$
:aE
odbcCon.Close(); ;$8ptB .
return ds; WYP\J1sy
s>1\bio*I
} stMxlG"d
此外 这种连接方式 还会莫名其妙的在创建连接的时候出错 出错内容如下 'T(
Q
ERROR [HZ080] [ATI][OpenRDA ODBC]RDA error: Resource not available - Connect error: da=PMSDK;Driver=PMSDK;engine=PM;lf=C:\temp\PMSDK.LOG;lo=verbose;pg=1;pp=pubuser;pu=pubuser;. Aar
]eY\
Error returned from engine: VDB.Connect; EAccessViolation=Access violation at address 101C120E in module 'PMSDK.dll'. Read of address 00000020 qu!x#OY+
Error number: 0x80004005 Hzc}NyJ
ERROR [01000] [Microsoft][ODBC 驱动程序管理器] 驱动程序不支持这个应用程序请求的 ODBC 行为的版本 (参见 SQLSetEnvAttr)。