vote up 0 vote down star

In VS 2005, using VB, page has a FormView linked to an SqlDataSource. When data is changed and Update button pressed, changed data is cleared in FormView but database table is not updated. Below is the SqlDataSource code. Any ideas why the Update doesn't work?

<asp:SqlDataSource ID="SqlDataDetails" runat="server" ConflictDetection="CompareAllValues"
   ConnectionString="<%$ ConnectionStrings:ALFSConnectionString %>" 
   ...
   ...
   OldValuesParameterFormatString="original_{0}" 
   ProviderName="<%$ ConnectionStrings:ALFSConnectionString.ProviderName %>"
   SelectCommand="SELECT * FROM [Resident] WHERE ([Resident_ID] = ?)" 
   UpdateCommand="UPDATE [Resident] SET [Resident_Company_ID] = ?, ..., [Resident_Diet] = ?, [Resident_Social_Security] = ? WHERE [Resident_ID] = ?" >
   <UpdateParameters>
      <asp:SessionParameter Name="Resident_ID" SessionField="Resident_ID" Type="String" />
      <asp:Parameter Name="Resident_Company_ID" Type="Int32" />      ...            
      ...            
      ...            
      <asp:Parameter Name="original_Resident_Diet" Type="String" />
      <asp:Parameter Name="original_Resident_Social_Security" Type="Int32" />
   </UpdateParameters>
   ...            
   ...            
   <SelectParameters>
      <asp:SessionParameter Name="Resident_ID" SessionField="Resident_ID" Type="String" />
   </SelectParameters>
</asp:SqlDataSource>
flag
You need to highlight your code (including asp and html markup) and use the "code" button (101 010) on the editor toolbar for it to be marked and highlighed as code properly! Otherwise it won't even show up in your posting..... – marc_s Jan 3 at 21:11

1 Answer

vote up 0 vote down

Have a look here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.aspx

What is your DataSourceMode, and/or are you calling .Update() if applicable?

link|flag
Thanks for the reply. I'm up against a deadlilne. My SqlDataSource control DataSourceMode i DataSet. In my VB code I only call Page_Load. – dbellerue Jan 5 at 13:37

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.