Skip to content

Datagridview problem. fill & update

Irakli Lekishvili

Asked Oct 29, 2010, 11:56 AM EDT1 answer
Share
LinkedInX
Hello everybody. I have form which getting data from table 'Selling' in this table is next columns
Code
 ID - int (have primary key)
BarCode - varchar(100)
ArtNumber - varchar(100)
ProductName - varchar(100)
Price - money
SelfPrice - money
PriceWithOutAWD - money
Comment - nvarchar(50)
DateTime - datetime
Quantity - nvarchar(50)


DataGridView DataSource is sellingBindingSource1. In this for is toolStripMenu with button this button

Code
 private void TsmRefresh_Click(object sender, EventArgs e)
 {            
sqlDataAdapter1.Fill(dataSet11); 
 }

when i press this button it does not refresh it dublicates same data
next button gets this error Failed to convert parameter value from a String to a Int32. this is button:
Collapse
Code
 private void TsmUpdate_Click(object sender, EventArgs e
 {        
  sqlDataAdapter1.Update(dataSet11);  
 }

so my datagridview have problems. Does anybody knows where is problem?
When this form is loading this code works fine :
 
Code
 private void TradeLog_Load(object sender, EventArgs e)  
 {           
 sqlDataAdapter1.Fill(dataSet11);   
 }
Thanks

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Suthish Nair
    0
    set dgv.DataSource = null;, before binding the records
    0