Passing a SQL parameter to an IN() clause using typed datasets in .NET

后端 未结 8 2073
别跟我提以往
别跟我提以往 2020-11-28 10:31

First apologies as there are similar questions on this site, but none of them answer this problem directly.

Im using typed datasets in VS 2010. I create a TableAdapt

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 11:10

    I was able to solve this by setting the ClearBeforeFill property to to false and filling the TableAdapter in a foreach loop.

    List aList = new List();
    aList.Add("1");
    aList.Add("2");
    aList.Add("3");
    
    yourTableAdapter.ClearBeforeFill = true;
    yourTableAdapter.Fill(yourDataSet.yourTableName, ""); //clears table
    
    foreach (string a in aList)
    {
        yourTableAdapter.ClearBeforeFill = false;
        yourTableAdapter.Fill(yourDataSet.yourTableName, a);
    }
    yourTableAdapter.Dispose();
    

提交回复
热议问题