I have read countless exception examples on the web but i could not find "item not found exception " . Before it drives me nut, please hlp

Hi,
would you mind pasting some of the code in here? So we can see what is going wrong?
thx
Mitja

Have you some code that shows off this error?

It's an exception that comes out of automating windows powershell, usually generated when you tell it to use a specific file that doesn't exist.

i am sorry guys . I did my best but still i don't know how to throw "item not found"
exception when given item doesn't exist in the table.How can i improve the below code
which is ok

      try { 
  SQLiteConnection connection = gcnew SQLiteConnection();             
  connection.ConnectionString = "Data Source = atbdn3.db3";
  connection.Open(); 
  string selecteditem = (textBox1.Text).ToString();
  SQLiteCommand command = connection.CreateCommand();  
  command.CommandText ="select energy from table where product ='"+selecteditem +"'" ;     
    SQLiteDataReader dataReader = command.ExecuteReader();

    if (dataReader.HasRows == true)
    {
           while (dataReader.Read())
           {
              label1.Text = dataReader["energy_kcal"].ToString(); 
           }
     }

    else
    {
    MessageBox.Show("ITEM NOT FOUND.");  // item not found error i-m-i-t-a-tion ! 

    }

    connection.Close();

     }

    catch(Exception e )  {

     MessageBox.Show(e.Message) ;  // SQLite error : no such table

 }

Simple. There is no data under the energy column, which would equal to the product (selected item).

if item is not in the table the query should stop execution

Try this code, and let me know it the "file not found" message appears:

if (dataReader.Read())
    label1.Text = dataReader["energy_kcal"].ToString();
else
    MessageBox.Show("ITEM NOT FOUND."); // item not found error i-m-i-t-a-tion !

Mitja

yes bonca but you know what i want smt e.Message which equals item not found please

oh. You want an Exception message? You can only have Exception message on try, catch block (only on catch actually).
I doubt here is possible do it so. But you can write your own, like you did above; just write a messageBox with your own description.

there is a saying which i like, let it go

issue solved. Thanks all attention.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.