Not sure if this is the best way, but you can put condition before insert code.
if(!string.IsNullOrEmpty(ddd) && !string.IsNullOrEmpty(eee))
{
string dgdat = "INSERT INTO VCHAMT (compcode,VOU_TYPE,VOU_NO,AMOUNT,VOU_DT,DR_CR,NARRATION,AC_CODE,CHEQUE_NO,CHEQUE_DT,BANK_NAME,BRANCH)values('" + Compcls.Gcomp_cd + "','" + vctype + "','" + txtvoucherno.Text + "','" + ddd + "','" + (Convert.ToDateTime(dateTimePicker1.Text)).ToString("yyyy/MM/dd") + "','" + eee + "','" + fff + "','" + AC_cod + "','" + cno + "','" + cdate + "','" + bank + "','" + branch + "')";
SqlCommand cmd1 = new SqlCommand(dgdat, con, trans);
cmd1.ExecuteNonQuery();
}