i am facing one problem, i don't know why this occurs please help.
when i try to get first result of the linq query, query return null value, while in db, there is record.
when i pass PosCustomerID=00445856363109679106 is working corrent no error. but when i pass PosCustomerID=00445856363109679107 its throw an exception:"string must be exactly one character long"
my code query is:
<pre lang="C#"> POSCustomer updCustomer = (from lC in UpdateCustomerDB.POSCustomers
where lC.POSCustomerID == lBShipToAddress.PosCustomerID
select lC).Single();
i also try this:
1)POSCustomer updCustomer = (from lC in UpdateCustomerDB.POSCustomers
where lC.POSCustomerID == lBShipToAddress.PosCustomerID
select lC).SingleOrDefault();
2)
POSCustomer updCustomer = (from lC in UpdateCustomerDB.POSCustomers
where lC.POSCustomerID == lBShipToAddress.PosCustomerID
select lC).FirstOrDefault();
3)
POSCustomer updCustomer = (from lC in UpdateCustomerDB.POSCustomers
where lC.POSCustomerID == lBShipToAddress.PosCustomerID
select lC).First();
my linq.dbml code generated for that fiels are below:
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage=&quot;_POSCustomerID&quot;, DbType=&quot;VarChar(23) NOT NULL&quot;, CanBeNull=false, IsPrimaryKey=true)]
public string POSCustomerID
{
get
{
return this._POSCustomerID;
}
set
{
if ((this._POSCustomerID != value))
{
this.OnPOSCustomerIDChanging(value);
this.SendPropertyChanging();
this._POSCustomerID = value;
this.SendPropertyChanged(&quot;POSCustomerID&quot;);
this.OnPOSCustomerIDChanged();
}
}
}</pre></pre>
=