我有以下存储过程:
CREATE PROCEDURE abc
AS
SELECT CustomerID
FROM Customers
WHERE CustomerID < 10
SELECT GuarantorID
FROM Guarantors
WHERE GuarantorID < 10
我的datagridview中有两列。我想在第一列中显示CustomerID
,在第二列中显示GuarantorID
我的C#代码在datagridview上没有显示任何值
using (SqlConnection conn = new SqlConnection(connection))
{
using (SqlCommand cmd = new SqlCommand("dbo.abc", conn))
{
SqlDataAdapter sda = new SqlDataAdapter("abc",conn);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
DataTable dt = new DataTable();
sda.Fill(dt);
dataGridView1.DataSource = dt.DefaultView;
}
}