i just dont know what to do after i make it equal to dataListSQL.Update(). I'm not getting a true error where it pops up and tells me... i added a watch and its just not firing i dont think. The error i listed is what my watch said.
You lost me there.
Can you post a complete simplified version of your code that shows the problem?
Protected Sub DataList1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dataList1.UpdateCommand
Dim SupplierContactNum As String = dataList1.DataKeys(e.Item.ItemIndex).ToString
Dim SupplierContact As TextBox = CType(e.Item.FindControl("EditSupplierContactTB"), TextBox)
Dim TitlePosition As TextBox = CType(e.Item.FindControl("EditPositionTB"), TextBox)
Dim SupplierPhone As TextBox = CType(e.Item.FindControl("EditSupplierPhoneTB"), TextBox)
Dim CellPhone As TextBox = CType(e.Item.FindControl("EditCellTB"), TextBox)
Dim Address As TextBox = CType(e.Item.FindControl("EditAddressTB"), TextBox)
Dim Extension As TextBox = CType(e.Item.FindControl("EditExtensionTB"), TextBox)
Dim Email As TextBox = CType(e.Item.FindControl("EditEmailTB"), TextBox)
Dim Fax As TextBox = CType(e.Item.FindControl("EditSupplierFaxTB"), TextBox)
dataListSQL.UpdateParameters("SupplierContact").DefaultValue = SupplierContact.Text
dataListSQL.UpdateParameters("Title").DefaultValue = TitlePosition.Text
dataListSQL.UpdateParameters("SupplierPhone").DefaultValue = SupplierPhone.Text
dataListSQL.UpdateParameters("CellPhone").DefaultValue = CellPhone.Text
dataListSQL.UpdateParameters("Address").DefaultValue = Address.Text
dataListSQL.UpdateParameters("Ext").DefaultValue = Extension.Text
dataListSQL.UpdateParameters("EmailAddress").DefaultValue = Email.Text
dataListSQL.UpdateParameters("SupplierFax").DefaultValue = Fax.Text
'''''not firing'''''
dataListSQL.Update()
''''''''''''''''''''
dataList1.EditItemIndex = -1
dataList1.DataBind()
End Sub
What I'm receiving when I "Add Watch" on Update is what the title of this thread is
I'm not getting a true error where it pops up and tells me... i added a watch and its just not firing i dont think. The error i listed is what my watch said.
So at this point you are receiving no error at all, and the code is executing completely but your Update is not being reflected in SQL Server correct? Have you checked SQL Server directly to see if the record actually was updated?
I am sorry. I see you checked it, but you did not state if it actually was updated. I am assuming it was not Updated and you were able to verify this?
If the Update is not working, can you run the SQL manually using the parameters extracted by debugging the code and inserting them manually into the UPDATE statement, but run directly from SQL Server? At this point if you are not receiving a .NET exception,
we need to see if the actual SQL has an issue. If you are fimilar with setting up a trace in SQL Server, you can also sniff out what SQL is actually being sent to the databse to see if it is 1. actually being sent, and 2. in the proper format.
mkamoski
Contributor
5694 Points
1565 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 04:32 PM|LINK
You lost me there.
Can you post a complete simplified version of your code that shows the problem?
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 04:49 PM|LINK
Protected Sub DataList1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dataList1.UpdateCommand Dim SupplierContactNum As String = dataList1.DataKeys(e.Item.ItemIndex).ToString Dim SupplierContact As TextBox = CType(e.Item.FindControl("EditSupplierContactTB"), TextBox) Dim TitlePosition As TextBox = CType(e.Item.FindControl("EditPositionTB"), TextBox) Dim SupplierPhone As TextBox = CType(e.Item.FindControl("EditSupplierPhoneTB"), TextBox) Dim CellPhone As TextBox = CType(e.Item.FindControl("EditCellTB"), TextBox) Dim Address As TextBox = CType(e.Item.FindControl("EditAddressTB"), TextBox) Dim Extension As TextBox = CType(e.Item.FindControl("EditExtensionTB"), TextBox) Dim Email As TextBox = CType(e.Item.FindControl("EditEmailTB"), TextBox) Dim Fax As TextBox = CType(e.Item.FindControl("EditSupplierFaxTB"), TextBox) dataListSQL.UpdateParameters("SupplierContact").DefaultValue = SupplierContact.Text dataListSQL.UpdateParameters("Title").DefaultValue = TitlePosition.Text dataListSQL.UpdateParameters("SupplierPhone").DefaultValue = SupplierPhone.Text dataListSQL.UpdateParameters("CellPhone").DefaultValue = CellPhone.Text dataListSQL.UpdateParameters("Address").DefaultValue = Address.Text dataListSQL.UpdateParameters("Ext").DefaultValue = Extension.Text dataListSQL.UpdateParameters("EmailAddress").DefaultValue = Email.Text dataListSQL.UpdateParameters("SupplierFax").DefaultValue = Fax.Text '''''not firing''''' dataListSQL.Update() '''''''''''''''''''' dataList1.EditItemIndex = -1 dataList1.DataBind() End SubWhat I'm receiving when I "Add Watch" on Update is what the title of this thread is
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 04:54 PM|LINK
I tried to add a screenshot but it didnt work.
atconway
All-Star
16846 Points
2756 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 08:49 PM|LINK
Can you please post the source in the page behid that defines the 'dataListSQL' control? It should be the code that begins with:
<asp:SqlDataSource id="dataListSQL"MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 24, 2010 12:00 PM|LINK
<asp:SqlDataSource ID="dataListSQL" runat="server" ConnectionString="<%$ ConnectionStrings:NCMRConnectionString3 %>" SelectCommand="SELECT SupplierContactNum, SupplierContact, Title, CellPhone, SupplierPhone, Address, Ext, EmailAddress, SupplierFax FROM [Supplier List] WHERE (Supplier = @SupplierDDL)" UpdateCommand="UPDATE [Supplier List] SET SupplierContact=@SupplierContact, Title=@Title, SupplierPhone=@SupplierPhone, CellPhone=@CellPhone, Address=@Address, Ext=@Ext, EmailAddress=@EmailAddress, SupplierFax=@SupplierFax WHERE SupplierContactNum=@SupplierContactNum" > <UpdateParameters> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="SupplierPhone" Type="String" /> <asp:Parameter Name="CellPhone" Type="String" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="Ext" Type="String" /> <asp:Parameter Name="EmailAddress" Type="String" /> <asp:Parameter Name="SupplierFax" Type="String" /> <asp:Parameter Name="SupplierContact" Type="String" /> <asp:Parameter Name="SupplierContactNum" Type="Int32" /> </UpdateParameters> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="SupplierDDL" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource>atconway
All-Star
16846 Points
2756 Posts
Re: Update is a type and cannot be used as an expression
Feb 24, 2010 01:34 PM|LINK
So at this point you are receiving no error at all, and the code is executing completely but your Update is not being reflected in SQL Server correct? Have you checked SQL Server directly to see if the record actually was updated?
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 24, 2010 02:23 PM|LINK
Correct. And yes I have.
atconway
All-Star
16846 Points
2756 Posts
Re: Update is a type and cannot be used as an expression
Feb 24, 2010 03:13 PM|LINK
I am sorry. I see you checked it, but you did not state if it actually was updated. I am assuming it was not Updated and you were able to verify this?
If the Update is not working, can you run the SQL manually using the parameters extracted by debugging the code and inserting them manually into the UPDATE statement, but run directly from SQL Server? At this point if you are not receiving a .NET exception, we need to see if the actual SQL has an issue. If you are fimilar with setting up a trace in SQL Server, you can also sniff out what SQL is actually being sent to the databse to see if it is 1. actually being sent, and 2. in the proper format.