如何在SSRS中为我的自定义代码添加System.Data.SqlClient引用?

时间:2011-12-26 15:33:17

标签: reporting-services

public string getLabel(int ReportID, int labelID)
{
    string s;
    System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection("Data Source=*****;Persist Security Info=True;Password=****;User ID=*********;Initial Catalog=iLoyaltyDW");
    SqlCommand myCommand = new SqlCommand();
    myCommand.Connection = myConnection;
    myCommand.CommandType = CommandType.Text;
    myCommand.CommandText = "select ....";
    myConnection.Open();

    SqlDataReader reader = myCommand.ExecuteReader();

    while (reader.Read())
    {
        s = reader.GetString(0);
    }

    return s;         
}

1 个答案:

答案 0 :(得分:0)

您需要从报告属性U / I

添加对程序集的引用

在这里查看步骤和注意事项:

http://msdn.microsoft.com/en-us/library/ms155974.aspx