各位高手,最近CE下的项目需要从sqlserver的数据库移植到informix的数据库。
环境:linux操作系统用开源版本centos6.5
informix免费版:IBM Informix Dynamic Server Version 11.70.FC8IE
VS2008,程序运行:CE5与CE6,终端型号:MC3090(ce5)与MC3190(ce6)
我按照ado.net的连接试了下,下载了IBM.Data.Informix.dll 版本:3.0.0.2 添加引用
string s = "Database=dbbos;Host=10.1.31.101;"
+"Server=xxx;Service=xxx;Protocol=onsoctcp;"+
"UID=informix;Password=xxxx;"+
"CLIENT_LOCALE=zh_CN.GB18030-2000;"+
"DB_LOCALE=zh_CN.GB18030-2000;";
IfxConnection c = null;
try
{
c = new IfxConnection(s);
c.Open();
this.Text = c.Server + " " + c.ServerType + " " + c.ServerVersion;
string sql="select * from goods where barcodeid='6921168509256'";
IfxCommand ic = new IfxCommand(sql,c);
IfxDataReader fd= ic.ExecuteReader();
if(fd.Read())
{
MessageBox.Show(fd["barcodeid"].ToString());
MessageBox.Show(fd["goodsname"].ToString());
}
Clipboard.SetText(this.Text);
}catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
if (c != null && c.State != ConnectionState.Closed) c.Close();
if (c != null) c.Dispose();
c = null;
}
然后成功连接了。不过当我移植之后,编译不通过。说我没引用错误
145 类型“System.Data.Common.DbConnection”在未被引用的程序集中定义。必须添加对程序集“System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”的引用。
然后我尝试去ado.net的system.data.dll文件拷贝出来,然后引用,却无法引用。
请各位大神告知下如何能连接成功?如果用odbc是否在服务器端下需要配置dns?有详细的方式提供最好了,谢谢!!