0

请参考代码

DataRow[] rowToUpdate = database1DataSet1.Tables["purchase_invoice"].
                    Select(string.Format("PuchaseInvoiceId = '{0}' ",cbPurchaseInvoiceId.Text)); 

 error' Cannot perform '=' operation on System.Int32 and System.String.

有解决办法吗?

4

1 回答 1

1
DataRow[] rowToUpdateUpdate = database1DataSet1.Tables["purchase_invoice"].                 
           if(cbPurchaseInvoiceId.Text.Trim()!="")
           Select(string.Format("PuchaseInvoiceId = '{0}' ",cbPurchaseInvoiceId.Text)); 

或者

BindingSource bs = new BindingSource();
bs.DataSource = database1DataSet1.Tables["purchase_invoice"];
private void cbPurchaseInvoiceId_TextChanged(object sender, EventArgs e)
{
    if(cbPurchaseInvoiceId.Text .Trim ()!="")
    bs.Filter = string.Format("PuchaseInvoiceId = '{0}'", int.Parse    (txtempname.Text));
}
于 2013-10-30T08:12:13.657 回答