Link to home
Start Free TrialLog in
Avatar of JDL129
JDL129

asked on

C# error message when getting a table from an adapter

Hey guys!!!

I have the following code snippet:

DataTable tblCustomersTbl = tblCustomerAd.GetDataByDAAPatId(strDAAPatID);

If I go to the adapter and run it using a valid strDAAPatID I get a record but if I run it from the code using the same value I get:
String or Binary data would be truncated

Any idea would be helpful!!!

Thanks
Jerry
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JDL129
JDL129

ASKER

kaufmed!!!  Thanks for the post!!

The length of the values in strDAAPatID is 9 and the length in the datatable Customer is 9.
Do I need to trim the variable?

Thanks,
Jerry
No, you shouldn't if the data going to the DB is equal (or less than) the length of the data allowed by the column. Is that the *only* parameter going to the database?
Avatar of JDL129

ASKER

Yes, that is the only parameter.  It is always 9 and the column width in sqlserver is nvarchar(50).
Avatar of JDL129

ASKER

Sorry for the delay but you were right on!!!!!