try with
mycnOptionPanel.Open();
mycmdOptionPanel = mycnOptionPanel.CreateCommand();
mycmdOptionPanel.CommandText = "select Device_ID from DEVICE_INFO where Device_name=?"; mycmdOptionPanel.Parameters.AddWithValue("@Device_name",LabelDeviceName.Text);
string strDeviceID =Convert.ToString(mycmdOptionPanel.ExecuteScalar());