在.NET中连接到DB2 [英] Connection to DB2 in .NET
本文介绍了在.NET中连接到DB2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我试图在我的应用程序中连接DB2数据库,但出现此错误:
错误[42704] [IBM] [DB2/NT] SQL0204N"DB2ADMIN.TBL_USER"是未定义的名称."
请帮助我解决此错误.
Hi
I am trying to connect DB2 database in my application I get this error:
"ERROR [42704] [IBM][DB2/NT] SQL0204N "DB2ADMIN.TBL_USER" is an undefined name."
Please help me on solving this error.
string connString = "Database=dbName;userID=usrname;password=pass server=servername";
using (DB2Connection con = new DB2Connection(connString))
{
DB2Command cmd = new DB2Command("SELECT * FROM TBL_USER", con);
DataTable dTable = new DataTable();
DB2DataAdapter adapter = new DB2DataAdapter(cmd);
adapter.SelectCommand = cmd;
adapter.Fill(dTable); //Error is executed here.
return dTable;
}
推荐答案
我猜该表确实在用户DB2ADMIN的架构中.尝试这样的事情:
I''d guess that the table does in user DB2ADMIN''s schema. Try something like this:
DB2Command cmd = new DB2Command("SELECT * FROM dbo.TBL_USER", con);
dbo
将代替表TBL_USER真正位于的模式.
问候,
Where dbo
shall be substituted for the schema your table TBL_USER is really in.
Regards,
这篇关于在.NET中连接到DB2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文