查看数据而无需重新启动应用程序 [英] View data without having to restart application
本文介绍了查看数据而无需重新启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我是编程方面的新手,我遇到了一个问题,即在网络上进行搜索还没有为我提供解决方案.我可以将新记录保存到数据库,但是必须重新启动应用程序才能查看新条目.下面是我用来将记录发送到数据库的代码.非常感谢您的帮助.
Hello all, I am a newbie in programming and I have come across a problem that searches on the web hasn''t yet presented me with a solution. I am able to save a new record to a database but I will have to restart the application in order to view the new entry. Below is the code that I use to send the record to the database. Any help is highly appreciated.
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection("Data Source=ACER-SVR;Initial Catalog=ISL;Integrated Security=True");
private void button1_Click(object sender, EventArgs e)
{
string select = "Select * from isltb";
SqlDataAdapter da = new SqlDataAdapter(select, con);
SqlCommand insert = new SqlCommand("_insert", con);
insert.CommandType=CommandType.StoredProcedure;
insert.Parameters.Add("@com", SqlDbType.NVarChar).Value = textBox1.Text;
insert.Parameters.Add("conper", SqlDbType.Text).Value = textBox5.Text;
insert.Parameters.Add("@desig", SqlDbType.Text).Value = textBox6.Text;
insert.Parameters.Add("@tel", SqlDbType.Int).Value= int.Parse(textBox4.Text);
insert.Parameters.Add("@mob", SqlDbType.Int).Value= int.Parse(textBox7.Text);
insert.Parameters.Add("@addr", SqlDbType.NVarChar).Value= textBox8.Text;
insert.Parameters.Add("@email", SqlDbType.NVarChar).Value = textBox9.Text;
con.Open();
insert.ExecuteNonQuery();
MessageBox.Show("...SUCCESS...");
da.Fill(ds, "isltb");
con.Close();
}
推荐答案
那么为了查看新条目",您尝试了什么?
您所需要做的就是创建一个从数据库中检索它的查询.
So what have you tried in order to "view the new entry"?
All you have to do is create a query that retrieves it from the database.
这篇关于查看数据而无需重新启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文