这是窗体里按钮触发的事件:
private void btnInsert_Click(object sender, EventArgs e)
        {
            string b; int r;
            db1 intser1 = new db1();
            intser1.add( b,r );
            if (r> 0)
            {
                MessageBox.Show("插入数据成功");
            
            }
            
        }这是dll文件里连接数据库的语句:
namespace mydl
{    
      public class db1
        {
      public void add(string a,int row) 
        {
            string strConn = "Data Source=DESKTOP-DBGUUB5;Initial Catalog=chap2;Integrated Security=True";
            SqlConnection conn = new SqlConnection(strConn);
            conn.Open();
            string strSql = 
            "INSERT INTO Products (ProductID,ProductName,SuPPlierName,CategoryName,UnitPrice,UnitsInStock,Discount)VALUES ('0012', '双层蒸锅', '苏泊尔集团','厨具','129','100','f')";
            SqlCommand comm = new SqlCommand(strSql, conn);
            row = comm.ExecuteNonQuery();
            a=Convert.ToString(comm);
            conn.Close();
        }
    }
}