Showing posts with label protected. Show all posts
Showing posts with label protected. Show all posts

Friday, February 24, 2012

Error - updating tables row using SqlDataSource

I have such a problem:

i try to update a row in my table using:

protected void selectButton_Click(object sender, EventArgs e)
{
String taskID = projectsGridView.SelectedRow.Cells[0].Text;
usersSqlDataSource.UpdateCommand = "update [Users] set [TaskID]=@.task where [UserID]=1";
usersSqlDataSource.UpdateParameters.Add("task", taskID);
usersSqlDataSource.Update();
}

And i receive error on usersSqlDataSource.Update():

You have specified that your update command compares all values on SqlDataSource 'usersSqlDataSource', but the dictionary passed in for oldValues is empty

What have i done wrong? Parameter are not set?

Check ConflictDetection attribute in your DataSource declaration.

Based on your usage it should be

ConflictDetection="OverwriteChanges"

Refer to the following link to better understand the implications of this setting

http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.sqldatasource.conflictdetection.aspx

|||

One way to solve this is to change the ConflictDetection property of your datasource to OverWriteChanges. At the moment it is set at CompareAllValues. If you want to keep the CompareAllValues setting, you need to add the old Values for each parameter to the UpdateParameters collection too.http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.oldvaluesparameterformatstring(vs.80).aspx

|||

Yes, it works fine now, thanks!

Sunday, February 19, 2012

Error - Attempted to read or write protected memory

Hi,

I am back with one more problem..

I have created few reports using SSRS 2005. I am using Oracle database in Data Source to fetch my data. It is working fine and showing me report correctly. But after running the report 8 to 10 times, it starts giving me Memory error. To get rid of that, I need to recycle (stop-start) ReportingService from IIS.

I am exactly getting following error...

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I am not getting the actual problem, why is it giving memory error only after running few times? Please let me know if anyone facing same problem or knowing the solution for the problem.

Thanks,

HMaheta

Dear HMaheta,

Check the DTC (Distributed Transaction Coordinator) service. It should be set up to to start automatically.

HTH,

Suprotim Agarwal

|||

Hi Suprotim,

Thanks for your reply.

I checked for the DTC. It is running on the server and also marked for auto start up.

Is there any other thing, which I am missing?

Thanks,

HMaheta