DataRow or DataColumn Default Width?

Gladimir

Well-known member
Joined
Mar 29, 2003
Messages
60
Location
San Diego, CA
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:
Code:
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);
   }
}
 
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.
 
Back
Top