Gladimir Posted April 9, 2003 Posted April 9, 2003 I have a function that reads data from fields in one table and populates fields in a second table. Specifically, a new row is added to the second table if the value of field n of the current row from the first table cannot be found in the second table. However, when I add the new row to the second table, the data from one particular field (the comparison field) is truncated to 50 characters. I am using tables from two separate access databases, but I have examined the table design properties and the widths for the correlating fields and all are 100 characters wide. Do Column objects have a default field-width of 50 characters? Before: Windows 2000 Hotfix (Pre-SP2) (See Q280838 for more information) After: Windows 2000 Hotfix (Pre-SP2) (See Q280838 for mor Relative Code Snippet: foreach (DataRow row in drc) { // does software already exist in deployed list? strSoftware = row["Software"].ToString().Trim(); string strSelect = "name = '" + strSoftware + "'"; DataRow[] foundRows = ds1.Tables["deployed"].Select(strSelect); // if software does not exist - add it if (foundRows.Length < 1) { DataRow newrow = ds1.Tables["deployed"].NewRow(); newrow["name"] = strSoftware; ds1.Tables["deployed"].Rows.Add(newrow); } } Quote Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
Gladimir Posted April 9, 2003 Author Posted April 9, 2003 Solution... The problem was created when I used a canned Data Adapter that I dragged and dropped from the Data Toolbox. The size property of all Text type parameters for the Update and, more importantly, the Insert commands are set to 50 by default. When I set the size property for the 'name' parameter to 100, the problem was corrected. Quote Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.