Working with a .NET 3.5 project and I have a DataTable I fill from a MySQL table. The table contains an "email" column that I need to search on. I am explicitly setting the primary key, and the following code works fine until I get 422 or more rows in the table.
object[] searchfor = new object[] { row["email"] };
DataColumn[] pk = new DataColumn[] { dtAccounts.Columns["email"] };
dtAccounts.PrimaryKey = pk;
match = dtAccounts.Rows.Find(searchfor);
I thought maybe there was some bad data in the 422nd record, but have verified that's not the case. The error I get is "Table doesn't have a primary key", which it obviously does.
My bad. I was filling my DataTable via web service, and once I got to 422 rows, the message size was too big and my DataTable never got filled. I just needed to increase the maxReceivedMessageSize value in my app.config file. Error message was less than helpful in this situation!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With