Hi,
Suppose using three tier architecture inserting four fields in patient table. Patient id is the primary key. Using this key I want to get data from table using three tier architecture and those to be displayed in textbox1, textbox2, textbox3 etc. I am using stored procedure to get query. Pls some body help me.
ShankeyPosted Sep 7, 2010, 3:30 AM
Following is the guide lines, But dont forget to mark my answer as accepted if it helped you little: :)
1)In the Application layer you should have function to populate your control.
2)In the Business logic layer you can have manupulation statements which is not applicable in you case.
3)In the Data Access layer you can have function to actually query the database like shown below:
Application layer:
FillUserDetails(User objuser)
{
txtUserName.text=objuser.UserName;
................
.........
.........
}
BLL: (Do manupulation Manupulation : if required)
Do calculation like age if age is not stored in db.
DAL: (Case for fetching user details)
private DataSet LoadByPrimaryKey(int UserId)
{
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "UserGet";
DbCommand dbCommandWrapper = db.GetStoredProcCommand(sqlCommand);
// Add in parameters
db.AddInParameter(dbCommandWrapper, "@UserId", DbType.Int32, UserId);
// DataSet that will hold the returned results
// Note: connection closed by ExecuteDataSet method call
return db.ExecuteDataSet(dbCommandWrapper);
}