-2

我正在我的一个应用程序中创建高级搜索工具。在该功能中,我必须存储选定的搜索条件。我的搜索结果基于 Logi XML...Logi XML 需要 SQL 内联语句,因此我必须将 sql 内联查询存储到数据库表中。

我当前的数据库中有下表。

Employee            Salary             PresentInfo
ID                   ID                    ID
Name                EMPID                 SalaryID
City                Basic                 TotalDays
State               HRA                   PresentDays  
Zip                 PF
Phone               DA

现在用户可以从上面的表格中选择任何标准。我正在将选定的标准管理到会话上下文中。我的意思是说我拥有用户选择的所有详细信息。我想用各自的连接在业务逻辑中创建动态 sql 内联语句。

业务逻辑类中的以下函数

public string GetDetails(List<Class1> Entity)
{
     //What should I write here? I have all the data in entity class
}

因此,如果有人对这种情况有任何想法,请帮助我。提前致谢。

4

1 回答 1

1

这是一个非常简短的 3 点,您可以从 [我假设您想要给定 id 的员工记录] 开始:

public Employee GetEmployeeDetails(int employeeId)
{
    //Create a connection to the data source

    //Query against datasource and get the result to a Employee with given employeeId

    //get the result and assing values to an employee instance

    //return employee
}
于 2012-07-15T17:22:03.707 回答