protected void Btn_InsertStream_Click(object sender, EventArgs e) { StreamList_Service stream = new StreamList_Service(); stream.UseDefaultCredentials = true; StreamList newstream = new StreamList(); newstream.Code = txt_code.Text; newstream.Description = Txt_Description.Text; newstream.Description_2 = Txt_Description2.Text; newstream.Start_Date = Convert.ToDateTime(Txt_startdate.Text); newstream.End_Date = Convert.ToDateTime(Txt_Enddate.Text); stream.Create(ref newstream); Response.Redirect("Streams.aspx"); }update code
protected void btn_Update_Click(object sender, EventArgs e) { StreamList_Service stream = new StreamList_Service(); stream.UseDefaultCredentials = true; StreamList newstream = new StreamList(); newstream.Code = txt_code.Text; newstream = stream.Read(newstream.Code); newstream.Description = Txt_Description.Text; newstream.Description_2 = Txt_Description2.Text; newstream.End_Date = Convert.ToDateTime(Txt_Enddate.Text); newstream.Start_Date = Convert.ToDateTime(Txt_startdate.Text); stream.Update(ref newstream); Response.Redirect("Streams.aspx"); }
Answers
newstream.Start_DateSpecified = true;
newstream.End_DateSpecified = true;
when creating the record.
These variables tells Visual studio which values it should include when sending data over the wire to NAV.
Reason why your update works is, that when you get the record back you get all fields (and all xxxSpecified = true).
xxxSpecified does not exist for string fields - these fields can be set to NULL in order to specify that you don't want it send over the wire.
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
Very insteresting... is this described somewhere in the documentation? ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.