write in database grid