Q:

Must declare the scalar variable "@PanId"

I know that this question has been asked many times and I have spend my 2 hours reading the solution on SO and other websites but couldn't solved it. So, please don't mark it as duplicate  Here is my code:-
dt = new DataTable();
                    dt = con.GetDataTable("select * from Panbnk_tran_t where emp_code='" + emp_code + "'", "Panbnk_tran_t");
                    if (dt.Rows.Count > 0)
                    {
                        string qry = "";
                        qry="insert into Panbnk_arc_t ";
                        qry +="(panid, cancel_checqe)";
                        qry += "values( @PanId, @Cancel_checqe)";
                        cmd = new OleDbCommand();
                        cmd.Parameters.Add("@PanId", SqlDbType.Image).Value = dt.Rows[0]["panid"];
                        cmd.Parameters.Add("@Cancel_checqe", SqlDbType.Image).Value = dt.Rows[0]["cancel_checqe"];
                        cmd = new OleDbCommand(qry, con.cnn);
                        cmd.ExecuteNonQuery();
                        }

EDIT:
using (var cmd = new OleDbCommand(qry, con.cnn))
                        {
                            cmd.Parameters.Add("@PanId", SqlDbType.Image).Value = dt.Rows[0]["panid"];
                            cmd.Parameters.Add("@Cancel_checqe", SqlDbType.Image).Value = dt.Rows[0]["cancel_checqe"];
                            cmd.ExecuteNonQuery();
                        }

I have tried this but same error again
Both the fields are image type

A:

dt = new DataTable();
dt = con.GetDataTable("select * from Panbnk_tran_t where emp_code='" + emp_code + "'", "Panbnk_tran_t");
if (dt.Rows.Count > 0)
{
            string qry = "";
            byte[] imgbytePan, imgbytecheque;
            imgbytePan = (byte[])dt.Rows[0]["panid"];
            imgbytecheque = (byte[])dt.Rows[0]["cancel_checqe"];
            qry = "insert into Panbnk_arc_t ";
            qry += "(panid, cancel_checqe)";
            qry += "values( ?, ?)";
            cmd = new OleDbCommand(qry, con.cnn);
            cmd.Parameters.Add("@imgPan", SqlDbType.Image).Value = imgbytePan;
            cmd.Parameters.Add("@imgChq", SqlDbType.Image).Value = imgbytecheque;
            cmd.ExecuteNonQuery();
 }

EDIT :
If you use sqlcommand then there is no need to use ? placeholders. Since OleDbCommand and OdbcCommand does not support named parameters, and use ? placeholders instead. For SqlCommand, it doesn't really care about the order of the parameters on your object so long as those parameters exist in the query.
For better explanation you can visit here.
Hope this made you clear.

