我想查询我图书馆数据库中的一本书,所以我写了这段代码......
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Web;
/// <summary>
/// Summary description for Book
/// </summary>
public partial class Book
{
public static List<Book> GetQueryBooks(string query)
{
// Init db
LibraryDataClassesDataContext db = new LibraryDataClassesDataContext();
return db.Books.Where(b => b.Title.Contains(query) || b.Author.Contains(query)).ToList();
}
}
但我不明白为什么我在返回时得到“InvalidCastException:指定的演员表无效”?