As it is, I would recommend making a very simplified sample.
Then, once that is done, I would recommend posting both the complete code-infront and the code-behind here.
Regarding this...
MCas86
I tried:
Dim myReturn as integer = dataListSQL.Update()
...what happended when you tried that? When you tried that that did you still get the same error "Update is a type and cannot be used as an expression"?
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.
MCas86
Member
25 Points
140 Posts
Update is a type and cannot be used as an expression
Feb 22, 2010 05:24 PM|LINK
'Update' is a type and cannot be used as an expression.
I've searched the forums and lowercased letters with no success.
Here is my code:
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 dataListSQL.Update() dataList1.EditItemIndex = -1 dataList1.DataBind()Thanks in advance.
mkamoski
Contributor
5694 Points
1565 Posts
Re: Update is a type and cannot be used as an expression
Feb 22, 2010 07:23 PM|LINK
What type of object is dataListSQL?
What type of object is dataList1?
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 22, 2010 07:42 PM|LINK
dataListSQL is a datasource
dataList1 is a datalist
mkamoski
Contributor
5694 Points
1565 Posts
Re: Update is a type and cannot be used as an expression
Feb 22, 2010 08:12 PM|LINK
>>>dataListSQL is a datasource
What kind of DataSource?
(Sorry to stickle.)
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 22, 2010 08:17 PM|LINK
SQLDataSource .. I think that's what your asking... What I selected to create it in the toolbox?
mkamoski
Contributor
5694 Points
1565 Posts
Re: Update is a type and cannot be used as an expression
Feb 22, 2010 08:34 PM|LINK
MCas --
Hmm.
There IS a parameterless Update method on the SqlDataSource-- that is a fact.
I suggest that in this case one should try this refactor...
Dim myReturn As Integer = dataListSQL.Update()
...and see this link...
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.update.aspx
...and check the code to be sure there is no object called "Update" anywhere...
...and check to make sure the UpdateCommand is set...
...and hopefully that will help.
HTH.
Thank you.
-- Mark Kamoski
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 22, 2010 08:49 PM|LINK
What I don't understand though is that it just started happening since:
-I changed the datakey
-Added a field
That's it. Anyways, I'm leaving work now. So if you reply, I won't reply until tomorrow at 8am. Thanks for your help. I'll test it tomorrow.
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 01:29 PM|LINK
I tried:
Dim myReturn as integer = dataListSQL.Update()
with no success. However, I'm not too sure what I'm supposed to do with myReturn afterwards.
mkamoski
Contributor
5694 Points
1565 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 02:39 PM|LINK
As it is, I would recommend making a very simplified sample.
Then, once that is done, I would recommend posting both the complete code-infront and the code-behind here.
Regarding this...
...what happended when you tried that? When you tried that that did you still get the same error "Update is a type and cannot be used as an expression"?
Please advise.
Thank you.
-- Mark Kamoski
MCas86
Member
25 Points
140 Posts
Re: Update is a type and cannot be used as an expression
Feb 23, 2010 03:03 PM|LINK
When i tried the Dim myReturn ...
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.