我有以下代码。当我运行程序并使用参数(例如 223)运行一次存储过程,然后使用参数(例如 315 ant)运行它,然后再次使用参数运行时,我得到了 System.Data.DataRowView” 而不是实际值。你能帮我下面的吗?
private void GetServers()
{
IDBManager dbManager = new DBManager (DataProvider.SqlServer);
dbManager.ConnectionString = @"Data Source=server; Initial Catalog=base; Integrated Security = SSPI;";
try
{
dbManager.Open();
dbManager.CreateParameters(1);
dbManager.AddParameters(0,"@report_id", (txtReportID.Text));
DataSet ds = new DataSet("Servers");
ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "sp_get_servers_from_report_test");
if (ds.Tables[0].Rows.Count > 0)
{
chkdListBoxServers.DataSource = ds.Tables[0];
chkdListBoxServers.DisplayMember = "Servers";
chkdListBoxServers.ValueMember = "server_name";
}
else
{
MessageBox.Show("No servers or incorrect report id");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
dbManager.Dispose();
}
}