Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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);
  }
}

Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
Posted

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.

Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...