答案 0 :(得分:0)
有很多方法可以做到这一点,我建议你使用linq to SQL
创建dbml类,请参阅此帖子http://blogs.msdn.com/b/charlie/archive/2007/11/19/connect-to-a-sql-database-and-use-the-sql-designer.aspx
然后你可以这样写:
var users = new ArrayList();
using (var db = new DataClasses1DataContext())
{
var query = db.USERS
foreach (var q in query)
{
users.Add(q);
}
}
return users;