Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
private void BindGridInventory()
{
  MySqlConnection con = new MySqlConnection("Server=localhost;UID=root;Database=db_cignal");
  MySqlDataAdapter sda = new MySqlDataAdapter("select * from inventory", con);
  MySqlCommandBuilder builder = new MySqlCommandBuilder(sda);
  DataSet dt = new DataSet();
  sda.Fill(dt);///this is where i get the error formatexception

  if (dt.Tables.Count > 0)
  {
    dataGridView1.DataSource = dt.Tables[0];
  }
}
Posted
Updated 23-Mar-15 4:59am
v2

1 solution

We can't tell from that: you need to start by looking at your database and what values the inventory table contains. Something is there is "different" and is causing the problem.
If you have a lot of data, it may help if you try retrieving "pages" of information until you find which "page" it's in - then narrow it down to a particular row from there using the same method.

SQL
SELECT * FROM
    (SELECT ColumnA, ColumnB, ROW_NUMBER() OVER (ORDER BY ColumnA DESC) AS R FROM inventory) AS A
WHERE A.R>=0 AND a.R<25
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900