请帮助解决这个问题 [英] please help about this problem

查看:75
本文介绍了请帮助解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


当我可以将数据插入数据库时​​,警报消息将显示在应用程序中.
我怎么能得到这个.....

预先感谢.


when i can insert data into database then the alert message will be displayed in the application.
how can i get this.....

Thanks in advance.

推荐答案

更新成功后,为用户显示一条消息.
应该不会比这更复杂.
Once the update succeeds, display a message for the user.
Should not be more complex than that.


尝试这个

try this

Con = new SqlConnection(ConfigurationManager.ConnectionStrings["yoConnectionString"].ConnectionString);
            Con.Open();
            Cmd = new SqlCommand("INSERT INTO InterviewCategories(Category)Values(@name)", Con);
            Cmd.Parameters.AddWithValue("@name", strCategoryName);

            if (Cmd.ExecuteNonQuery() > 0)
            {
               string Msg ="SUCCESS : Record has been inserted";
               ShowAlertMessage(Msg)
            }
            else
            {
                string Msg = "ERROR : SQL Exception";
            }

      public static  void ShowAlertMessage(string Msg)
 {

    Page page = HttpContext.Current.Handler as Page;
    if (page != null)
    {
        ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + Msg + "');", true);
    }
 }


这篇关于请帮助解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆