1
class InspectionEquip : DataSet
{
    private readonly SqlConnection CPEC = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());

    public InspectionEquip(string store)
    {
        CPEC.Open();
        SqlCommand comm = new SqlCommand("Select * From Equip3 Where Store = '" + store + "'", CPEC);
        SqlDataAdapter da = new SqlDataAdapter(comm);
        da.Fill(/* What to Put Here? Tried "this" and it just returns blank */);    
        CPEC.Close();
    }
}
4

1 回答 1

0

您的 SQL 查询有问题(没有匹配的数据,错误的参数)。da.Fill(this)工作正常。

如果你想要证据 -SqlCommand用你的交换这条线......

SqlCommand comm = new SqlCommand("select * from INFORMATION_SCHEMA.COLUMNS", CPEC);

如果您只计划存储单个表结果DataTable,您也应该可以扩展。DataSet

于 2012-05-30T15:06:34.450 回答