id不是从一个表传递到另一个表 [英] id is not passing from one table to another
本文介绍了id不是从一个表传递到另一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if (RadioNEW.Checked == true)
{
SqlConnection sc = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["hospitalmanagementdb"].ToString());
SqlCommand cmd = new SqlCommand("insert into patient values('" + txtFirstnm.Text + "','" + txtLastnm.Text + "','" + RadioMF.Text + "','" + txtAge.Text + "','" + txtContact.Text + "','" + txtEmail.Text + "','" + txtAddress.Text + "')", sc);
cmd.Connection = sc;
sc.Open();
cmd.ExecuteNonQuery();
sc.Close();
}
else
{
SqlConnection sc1 = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["hospitalmanagementdb"].ToString());
sc1.Open();
SqlCommand cm = new SqlCommand("insert into appointment values((select max(patient_id) from patient),'" + dropQueue.SelectedValue.ToString() + "','" + System.DateTime.Today.Date.ToString() + "','treated')", sc1);
cm.Connection = sc1;
cm.ExecuteNonQuery();
sc1.Close();
}
if (RadioNEW.Checked == true)
{
SqlConnection sc = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["hospitalmanagementdb"].ToString());
SqlCommand cmd = new SqlCommand("insert into patient values('" + txtFirstnm.Text + "','" + txtLastnm.Text + "','" + RadioMF.Text + "','" + txtAge.Text + "','" + txtContact.Text + "','" + txtEmail.Text + "','" + txtAddress.Text + "')", sc);
cmd.Connection = sc;
sc.Open();
cmd.ExecuteNonQuery();
sc.Close();
}
else
{
SqlConnection sc1 = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["hospitalmanagementdb"].ToString());
sc1.Open();
SqlCommand cm = new SqlCommand("insert into appointment values((select max(patient_id) from patient),'" + dropQueue.SelectedValue.ToString() + "','" + System.DateTime.Today.Date.ToString() + "','treated')", sc1);
cm.Connection = sc1;
cm.ExecuteNonQuery();
sc1.Close();
}
患者表的ID未通过预约表
id of patient table is not passing in appointment table
推荐答案
这篇关于id不是从一个表传递到另一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文