无法将类型 'System.Collections.Generic.List<ValueObjectLayer.booksVAL>' 隐式转换为 'int'

Cannot implicitly convert type 'System.Collections.Generic.List<ValueObjectLayer.booksVAL>' to 'int'

我正在尝试创建一个 3 层 C# 库管理项目。

我正在尝试 select 通过 booksBLL(businesslogiclayer)从 bookDAL(dataacceslayer)中获取一本书并将其显示在 winforms 上。

我在 BLL 上收到此错误消息 error

达尔:

    public static List<booksVAL> BookSelect(string x)
    {
        List<booksVAL> sonuc = new List<booksVAL>();
        OleDbCommand cmdkitaplistele = new OleDbCommand("select * from books where id = " + Int32.Parse(x) + " ", dbConnection.conn); // 
        if (cmdkitaplistele.Connection.State != ConnectionState.Open) // bağlantı açık değise
        {
            cmdkitaplistele.Connection.Open(); // bağlantıyı aç
        }

        OleDbDataReader dr = cmdkitaplistele.ExecuteReader(); // sorgu sonuçlarını data reader ile oku
        while (dr.Read())
        {
            booksVAL book = new booksVAL();
            book.bookId = int.Parse(dr["id"].ToString());
            book.bookName = dr["bookname"].ToString();
            book.bookAuthor = dr["authorname"].ToString();
            book.bookPagecount = dr["pagecount"].ToString();
            book.bookDatepublished = dr["datepublished"].ToString();
            book.bookIsavailable = dr["isavailable"].ToString();
            book.bookCategory = dr["category"].ToString();
            sonuc.Add(book);
        }
        dr.Close();
        return sonuc;
    }

BLL:

public static int BookSelect(string x)
{
    return booksDAL.BookSelect(x);

表格:

public partial class bookupdateForm : Form
{
   booksForm f1;
    public bookupdateForm(booksForm frm1)
    {
        InitializeComponent();
        this.f1 = frm1;
        booksBLL.BookSelect(f1.selectedlabel.Text); // selectedlabel comes from another form, it works

    }
}

问题在这里:

public static int BookSelect(string x)
{
    return booksDAL.BookSelect(x);
}

将 return 类型 int 更改为 List<booksVAL>:

public static List<booksVAL> BookSelect(string x)
{
    return booksDAL.BookSelect(x);
}