- 我想在 Windows 应用程序中创建 5-6 个表单以插入数据。
- 每个表单至少包含 15-20 个控件。所有表格属于不同的表格。但有些是一样的。
- 我必须在每个表单上创建存储的“下一步”命名按钮,这样当我单击下一个按钮时,该按钮上填写的所有信息都会存储在某个位置,
并以这种方式存储在提交按钮所在的最后一个按钮上的信息之后拖动,单击该提交按钮,所有数据都保存到数据库中。 - 请告诉我如何存储以前表单中插入的数据并在提交按钮的单击事件中调用它。
现在我在同一页面上拥有所有控件,并且我已使用这些代码进行插入。
private void submit_addbtn_Click(object sender, EventArgs e)
{
try
{
//personal data insert
Personal per = new Personal();
per.Name = nametxt.Text;
per.FatherName = f_nametxt.Text;
per.MotherName = m_nametxt.Text;
per.Gotra = gotra_txt.Text;
per.Panth = panthcb.Text;
per.FamilyHead = fhntext.Text;
per.Educationlvl = edulvlcb.Text;
per.Education = educb.Text;
per.Blood = bloodcb.Text;
per.Gender = genderlist.Text;
per.Marrital = MarritalStatus;
per.DateOfBirth = dobdtp.Text;
if (new InsertAction().Insertpersonal(per))
{
MessageBox.Show("Personal Insertion Happen ");
}
else
{
MessageBox.Show(" Personal Insertion does not Happen ");
}
// spouse data insert
Spouse sps = new Spouse();
sps.Spousename = s_nametxt.Text;
sps.Spouseeducationlvl = s_edulvlcb.Text;
sps.Spouseeducation = s_educb.Text;
sps.Spouseblood = s_bgcb.Text;
sps.Spousedob = s_dobdtp.Text;
if (new InsertAction().Insertspouse(sps))
{
MessageBox.Show(" Spouse Insertion Happen ");
}
else
{
MessageBox.Show(" Spouse Insertion does not Happen ");
}
// Resident data insert
Ressident resi = new Ressident();
resi.RessiHnumber = ressi_numtxt.Text;
resi.RessihCmplx = ressi_complextxt.Text;
resi.RessiStrt = ressi_streettxt.Text;
resi.RessiLandmrk = ressi_landtxt.Text;
resi.RessiArea = ressi_areatxt.Text;
resi.RessiCity = ressi_citytxt.Text;
resi.RessiPhone = Convert.ToInt64(ressi_phnotxt.Text);
resi.RessiMobile = Convert.ToInt64(mobi_notxt.Text);
if (new InsertAction().Insertressident(resi))
{
MessageBox.Show(" Ressident Insertion Happen ");
}
else
{
MessageBox.Show(" Ressident Insertion does not Happen ");
}
//occupation data insert
Occupation ocp = new Occupation();
ocp.Occuptype = occup_typetxt.Text;
ocp.Occupadd = office_addresstxt.Text;
ocp.Occupnature = occup_naturecb.Text;
ocp.Occupphone = Convert.ToInt64(office_phno1txt.Text);
ocp.Occupmobile = Convert.ToInt64(office_mobnotxt.Text);
if (new InsertAction().Insertoccupation(ocp))
{
MessageBox.Show(" Occupation Insertion Happen ");
}
else
{
MessageBox.Show(" Occupation Insertion does not Happen ");
}
}
请帮我。谢谢你。