110,536
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
string strCon = @"Data Source=.;Initial Catalog=MZYSGZZ;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False";
SqlConnection conn = new SqlConnection(strCon);
string sSQL = null;
sSQL = "insert into chufang(PatientID,MedID) values ('" + textBox1.Text + "','" + textBox2.Text + "');update chufang set MedName = (select top(1) MedName from Medical) where MedID = ('" + textBox2.Text + "'); update chufang set PatientName = (select top(1) PatientName from PatientInfo) where PatientID = ('" + textBox1.Text + "');update chufang set MedQuantity = ('" + textBox3.Text + "') where PatientID = ('" + textBox1.Text + "')";
SqlCommand cmd = new SqlCommand(sSQL, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
DataBinding2("select * from chufang");
}