Datagrid and Clear Method Error.

  • Thread starter Thread starter bryja_klaudiusz[at]poczta[dot]fm
  • Start date Start date
B

bryja_klaudiusz[at]poczta[dot]fm

Hi,

I have code that load DataSet with data from SQL Server Database using
OLE DB. When I want to fill datagrid with data I got error 0x80070057
(something like 'Zero is not valid value, use valu from minimum to
maximum').

Part of code which generate this Exception:

try
{
Grid.DataSource = null;
DataSet.Clear();
}
catch(System.Exception eLoadMerge)
{
...............
}

What is the problem? this error shows randomly.
 
Hi,

(assuming you use the WinForms DataGrid...)

If you want to fill the grid with data, is it really necessary to set the
DataSource property to null?
I'd recommend you used the SetDataBinding method instead, giving it an
already filled DataSet and the name of the table as the DataMember argument
value.
 
Back
Top