Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can we use datable while using Microsoft Enterprise Library for Data Access Application. I want to return datatable is it possible??
Posted

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;
	}

}
 
Share this answer
 
Yes you can use the DataTable object, even while using the Enterprise library.

What do you want to return it from?
 
Share this answer
 
Comments
suzzain 7-Sep-10 8:20am    
Thanx for replying....I want to return Employee information. Please tell me how i can do that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900