在将Microsoft Enterprise Library用于数据访问应用程序时,我们可以使用datable吗? [英] Can we use datable while using Microsoft Enterprise Library for Data Access Application
本文介绍了在将Microsoft Enterprise Library用于数据访问应用程序时,我们可以使用datable吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在将Microsoft Enterprise Library用于数据访问应用程序时,我们可以使用datable吗?我想返回数据表吗?
Hi,
Can we use datable while using Microsoft Enterprise Library for Data Access Application. I want to return datatable is it possible??
推荐答案
示例:
Example:
public static DataTable GetEmployee(string employeeName)
{
try {
Database db = DatabaseFactory.CreateDatabase("DataBase ConnectionString");
SqlCommand sqlCommand = new SqlCommand("select * from employee where name like @name");
db.AddInParameter(sqlCommand, "name", DbType.String, employeeName);
/*Returns first table as datatable*/
return db.ExecuteDataSet(sqlCommand.Tables(0));
}
catch (Exception ex) {
throw;
}
}
是的,即使使用企业库,也可以使用DataTable
对象.
您想从哪里退回它?
Yes you can use theDataTable
object, even while using the Enterprise library.
What do you want to return it from?
这篇关于在将Microsoft Enterprise Library用于数据访问应用程序时,我们可以使用datable吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文