Hello Miha
My DataAdapter called daClient is like this:
//
// daClient
//
this.daClient.DeleteCommand = this.sqlDeleteCommand2;
this.daClient.InsertCommand = this.sqlInsertCommand2;
this.daClient.SelectCommand = this.sqlSelectCommand2;
this.daClient.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "tblClient", new
System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("ClientID", "ClientID"),
new System.Data.Common.DataColumnMapping("LastName", "LastName"),
new System.Data.Common.DataColumnMapping("GivenName", "GivenName"),
new System.Data.Common.DataColumnMapping("Status", "Status"),
new System.Data.Common.DataColumnMapping("ReasonToCloseID",
"ReasonToCloseID"),
new System.Data.Common.DataColumnMapping("DOB", "DOB"),
new System.Data.Common.DataColumnMapping("Gender", "Gender"),
new System.Data.Common.DataColumnMapping("MaritalStat", "MaritalStat"),
new System.Data.Common.DataColumnMapping("ImmigStat", "ImmigStat"),
new System.Data.Common.DataColumnMapping("SIN", "SIN"),
new System.Data.Common.DataColumnMapping("HealthCard", "HealthCard"),
new System.Data.Common.DataColumnMapping("WorkPermit", "WorkPermit"),
new System.Data.Common.DataColumnMapping("Origin", "Origin"),
new System.Data.Common.DataColumnMapping("CameToCanada", "CameToCanada"),
new System.Data.Common.DataColumnMapping("FirstLang", "FirstLang"),
new System.Data.Common.DataColumnMapping("OtherLang", "OtherLang"),
new System.Data.Common.DataColumnMapping("ChildMinding", "ChildMinding"),
new System.Data.Common.DataColumnMapping("Education", "Education"),
new System.Data.Common.DataColumnMapping("Discipline", "Discipline"),
new System.Data.Common.DataColumnMapping("PrevOcc", "PrevOcc"),
new System.Data.Common.DataColumnMapping("PresOcc", "PresOcc"),
new System.Data.Common.DataColumnMapping("TargetOcc", "TargetOcc"),
new System.Data.Common.DataColumnMapping("WorkingNow", "WorkingNow"),
new System.Data.Common.DataColumnMapping("WorkingSince", "WorkingSince"),
new System.Data.Common.DataColumnMapping("WorkCDN", "WorkCDN"),
new System.Data.Common.DataColumnMapping("SourceIncome", "SourceIncome"),
new System.Data.Common.DataColumnMapping("Referal", "Referal"),
new System.Data.Common.DataColumnMapping("SocialWrk", "SocialWrk"),
new System.Data.Common.DataColumnMapping("ResumeLoc", "ResumeLoc"),
new System.Data.Common.DataColumnMapping("ResumeType", "ResumeType"),
new System.Data.Common.DataColumnMapping("PhoneType", "PhoneType"),
new System.Data.Common.DataColumnMapping("PhoneNum", "PhoneNum"),
new System.Data.Common.DataColumnMapping("AltPhoneType", "AltPhoneType"),
new System.Data.Common.DataColumnMapping("AltPhoneNum", "AltPhoneNum"),
new System.Data.Common.DataColumnMapping("Email", "Email"),
new System.Data.Common.DataColumnMapping("SingleMother", "SingleMother"),
new System.Data.Common.DataColumnMapping("LongTermGoal", "LongTermGoal"),
new System.Data.Common.DataColumnMapping("LongTermGoalComments",
"LongTermGoalComments"),
new System.Data.Common.DataColumnMapping("ShortTermGoal", "ShortTermGoal"),
new System.Data.Common.DataColumnMapping("ShortTermGoalComments",
"ShortTermGoalComments"),
new System.Data.Common.DataColumnMapping("NextStepComments",
"NextStepComments")})});
this.daClient.UpdateCommand = this.sqlUpdateCommand2;
My Expression DataColumn is defined as below in the form_load procedure:
private void frmClient_Load(object sender, System.EventArgs e)
{
DataColumn dcFullName = new DataColumn();
this.daClient.Fill(this.dsClient);
this.daChild.Fill(this.dsClient);
this.daClientAddress.Fill(this.dsClient);
dcFullName.DataType = System.Type.GetType("System.String");
dcFullName.ColumnName = "FullNameFN";
dcFullName.Expression = "GivenName + ' ' + LastName";
this.dsClient.tblClient.Columns.Add(dcFullName);
this.dvClient.Sort = "GivenName";
lstName.DataSource = dvClient;
lstName.DisplayMember = "dcFullName";
lstName.ValueMember = "ClientID";
lstName.SelectedIndex = 1;
}
I checked my autogenerated Update method, and it doesn't add the FullNameFN
in it either.
It acts funny, because the first time I click update, it works fine, the
second time, it throws an exception.
Any suggestion?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:(E-Mail Removed)...
> Hi Hemang,
>
> How is your daDataAdapter configured?
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> SLODUG - Slovene Developer Users Group
> www.rthand.com
>
> "Hemang Shah" <(E-Mail Removed)> wrote in message
> news:fbCdnZYf382HBmHcRVn-(E-Mail Removed)...
>>I have an expression DataColumn which combines "First Name" + "Last Name"
>>to display in the list box to select the name, who's record comes up.
>>
>>
>> But when I use the daDataAdapter.Update(dsDataSet, tblTableName); It
>> gives me an exception saying cannot update readonly expression type.
>>
>> How do I fix this?!
>>
>> Isn't Visual Studio a lot more powerful than access ? So far, I've found
>> serious limitation in the the controls of Visual Studio.. Like listbox &
>> ComboBox not being able to have multiple fields!...
>>
>> There are 3rd party solutions but they all are very expensive..
>>
>> Please let me know if there are any suggestion for my mentioned problem.
>>
>> Thank You
>>
>> HS
>>
>
>