Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 .Net 应用程序中使用 OleDB 来读取具有固定长度的二进制字段的 Access 数据库表。当我在它上使用该MaxLength属性时,DataTable它返回 -1,尽管在 Access DB 本身中我可以看到该字段的长度是 510 字节。我在任何地方都看不到字段长度-请您帮忙。
MaxLength
DataTable
您单元格中的数据将是一个字节数组。你可以把它的长度。
OleDbCommand cmd = new OleDbCommand("select data from db", mycon); System.Data.OleDb.OleDbDataReader dr; dr = cmd.ExecuteReader(); dr.Read(); temp = (byte[])dr["data"]; int len = temp.Length;