visual studio“/”应用程序中的服务器错误

调试后输入数据,点击按钮后显示“/”应用程序中的服务器错误

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace My_Web.Aspx
{
    public partial class Sell_Book : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlDataSource1.InsertCommand = "INSERT INTO Sell(Person_Id, Book_Id, Sell_Price, Sell_Count) VALUES (" + RadioButtonList1.SelectedValue + ", " + RadioButtonList2.SelectedValue + ", " + TextBox1.Text + ", " + TextBox2.Text + ")";

            SqlDataSource1.Insert();\\显示这句错误


            Response.Redirect("Sell_Book.aspx");
        }
    }
}

参考GPT和自己的思路:

这个问题可能是由于SqlDataSource1对象没有正确配置引起的。请检查SqlDataSource1对象的属性,确保它与你所需的数据库连接字符串一致。还应该确保该数据库已经在服务器上准备好了,和你正在运行你的应用程序的服务器在访问该数据库时有正确的权限。如果还有问题,请尝试使用try-catch块来捕捉异常并查看具体错误信息。