.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Update statement not updating records and returns no errors

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
I am running an Update statement against an SQL database on server 2008. The update runs but does not update the record, but returns no errors. The database is part of a commercial help desk package called TrackIt 8.5 which was just a fresh install on a new web server and a new sql server. The update is running from a web form we use to automatically create active directory accounts. After the account is created the web form closes out the work order in the Trackit db. This was working fine when the system was running on Server 2003 and SQL server 2005. Running Trackit version 7.02. The login use to access the database has full permissions to read and write to the database, just as it did on the old server which never had an issue updating. Odd thing is, if I log onto the SQL server and make a change to any single field in that record. I can then run the web form and it updates the record normally. All other update statements that are running on other databases are running fine. Anyone have any suggestions on what to check that may be causing this issue?

View Complete Post

More Related Resource Links

OPENQUERY Update statement errors


Right now, I am struggling with OPENQuery on multiple fronts.  a) Not sure if the stored proc code below is correct b) Getting multiple syntax and other errors with the code and its a high time for me to resolve this on an urgent basis.


Here's what I get when I run the following Create Stroed Proc command:


Server: Msg 7321, Level 16, State 2, Procedure sp_GroundSure_UpdateSentOrFailedRequest_new, Line 25
An error occurred while preparing a query for execution against OLE DB provider 'MSDAORA'.
[OLE/DB provider returned message: ORA-00936: missing expression
OLE DB error trace [OLE/DB Provider 'MSDAORA' ICommandPrepare::Prepare returned 0x80040e14].


Any help will be helpful in this regard.


CREATE PROCEDURE sp_UpdateSentOrFailedRequest_new



SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

sqldatasource's filter returns too few records


I have a puzzling issue.  This is in asp.net 2.0, using vb.  I have a gridview that is bound to a sqldatasource.  Here is the datasource code:

<asp:SqlDataSource ID="fellowsSqlDataSource" runat="server"
        ConnectionString="<%$ ConnectionStrings:PFPFellowsConnectionString %>"
        ProviderName="<%$ ConnectionStrings:PFPFellowsConnectionString.ProviderName %>"
        FilterExpression="{0}"  >
            <asp:SessionParameter Name="psuaccessid" SessionField="username" />         

changing records frm control in update panel


i have a list box, a command button and a grid

when i click a particular record / or multiple records on the  list box and then cclick the command button the records r transferred 2 the grid

i also have custom paging, the paging shld ocur as many times i clcik the command button

i have used updatepanel with the command button in it so that partial postback ocurs or there is no page flicker ,

but when i use update panel i get teh records in the grid but custom page is not working . it has no affect even if the records are added

if i remove update panel the paging works properly

how do i manage it with update panel

Looking for TSQL statement that returns customers with greatest number of order in descending order

What would be an efficient TSQL SELECT statement that joins customer and order tables, counts the orders for each customer (group by) and returns a result for all customers with at least one order, and also in descending order from customers with the most orders to the least?

Gridview's in Update Panel not updating

I have 2 gridviews in an update panel that for some reason will not update.  There is no data entry, paging, sorting going on, the data is just there to be displayed.  I'm using a timer that initiates every 5 minutes to trigger the updatepanel.  I also have an updatepanel on an additional page where I am also using a trigger to fire the updatepanel with 2 charts and 1 oneline/column gridview.  The 2 charts update just like they are supposed to however the gridview does not. Here is the code for the 2 Gridview aspx page:</head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Timer ID="Timer1" runat="server" Interval="300000" Enabled="True"> </asp:Timer> <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> <ContentTemplate> <table class="style1"> <tr>

Problem updating records with LINQ, Concurrency?

 My project includes a grid view with some updtable fields, some fields throw an error on update and some do not and it does not really make sense. WORK_STATION_ID does not cause an error, ROOM _ID cause an error, both are int? (I am using c#) and for update I use the code liste below.using (DataClassesDataContext db = new DataClassesDataContext()) { var product = (from p in db.ASSETs where p.ASSET_ID == ASSET_ID select p).Single(); product.WORK_STATION_ID=WORK_STATION_ID; product.ROOM_ID=ROOM_ID; db.SubmitChanges(); }    Row not found or changed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.Linq.ChangeConflictException: Row not found or changed. Source Error: Line 93: Line 94: Line 95: db.SubmitChanges(); Line 96: Line 97: Source File: C:\Projects\TEST_II\trunk\ObjectDataSourceLibrary\AssetController.cs Line: 95 Stack Trace: [ChangeConflictException: Row not found or changed.] System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) +963417 Syst

Allow or deny roles to update, insert and delete records.

Hello, I have two roles "Admin" and "Basic". I also have a listview on the web page. My goal is that to make "Admin" role has the highest privilege to deal with records such as "insert", "update" and "delete". For the role "Basic", it only can update the records. Is there any sample code for that? Thanks.  

update statement which i can use in execute sql task.

I am having a table in the following manner.I am having  yearmonth till 202012 and from 201005 to 202012 I am having activeflag,tablename1,tablename2,tablename3,tablename4 as zero. This table needs to be update before runing the package.Before I load data for tablename1 for 201005 I need to update that 201005 for tablename1 to 1 and activeflag to 1 and  I need to update the 201002 tablename1 to zero.and when I load data for 201006 I need to update first that active flag =1 for 201006 and tablename1 to 1 for 201006 and then Update 201003 tablename1 to zero.i.e in tablename1 at a given time i need to see only 3 (yearmonth)=1 and update the first non zero record to zero.similary i need to update other tables also.  yearmonth                      Activeflag           tablename 1       tablename2         tablename 3   tablename4 201001                             0                 &nb

Trying to use dropdownlist to update db - Not Updating?

I just can't figure out the problem here. I'm trying to first load the two drop down lists with the existing value from the database, then update them if a different value is selected before the Insert button is pressed.  But it's not updating the db when I select a different value. ASPX CODE<asp:SqlDataSource ID="SqlDataSource1" runat="server"         ConnectionString="<%$ ConnectionStrings:HOAConnectionString %>"         DeleteCommand="DELETE FROM [Homes] WHERE [HomeID] = @HomeID"         SelectCommand="SELECT [HomeID], [Subdivision], [Approved] FROM [Homes] WHERE ([HomeID] = @HomeID)"         UpdateCommand="UPDATE [Homes] SET [Subdivision] = @Subdivision, [Approved] = @Approved WHERE [HomeID] = @HomeID">        <SelectParameters>            <asp:QueryStringParameter DefaultValue="1" Name="HomeID" QueryStringField="ID"                 Type="Int32" />        </SelectParameters>   

Update Statement help from Multiple database

Hi I am having two separate datbase on same sever one datasbase name private from where i am executing my below query and other name is ODS Table name in Private=[A].[DimCapabilitySpecialty] Table name in ODS = [A].[CapabilitySpecialty]   both of them having column SpecialtyCd   i want to update the flag value of ODS table where there is particular specialitycd missing in source means table in private database   so for that i wrote below query   update A.DimCapabilitySpecialty set ActiveInd ='I' where SpecialtyCd !=[ODS].[A].[CapabilitySpecialty].[SpecialtyCd]   But it is giving me this error   Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "ODS.CapabilitySpecialty.SpecialtyCd" could not be bound.

SSIS Package returns the error - The command execution generated errors.

SSIS Package returns the error - 'The command execution generated errors'. Please let us know the cause for this error if anyone encountered this error before. Require a solution for this.   Thanks

Scope Statement Errors - Please Help ASAP!

Hello, I have  script that validates a criteria and then performs calculation based on the criteria. In general this is what is does, If account within the range of 100000 and 399999 then YTD AMT + Beg Balance else YTD AMT  Here is the script: CREATE MEMBER CURRENTCUBE.[Measures].[test]  AS NULL, VISIBLE = 1  ; Scope([Measures].[Actual Amount]); Scope (  EXCEPT  ( [COA AHC].[Account].MEMBERS, {[COA AHC].[Account].[100000]:[COA AHC].[Account].[399999]})) ;   This = Sum(YTD([Period].[YP - Hierarchy]), [Measures].[Actual Amount]); End Scope ; END SCOPE; Scope   ( {[COA AHC].[Account].[100000]:[COA AHC].[Account].[399999]},[Measures].[Actual Amount]) ;   This = Sum(YTD([Period].[YP - Hierarchy]), [Measures].[Actual Amount]) + [Measures].[Actual Beg Bal] ; End Scope ; It throws the following errors: 1) Error 1 MdxScript(FINANCE) (14, 1) An arbitrary shape of the sets is not allowed in the current context.   2) Error 2 MdxScript(FINANCE) (19, 1) The END SCOPE statement does not match the opening SCOPE statement.  3) Error 3 The END SCOPE statement does not match the opening SCOPE statement.  Can anyone please help me ASAP to resolve this? I am not sure what am doing wrong. Thank you all in advance. Thanks, KJ

Unable to update records using IN clause

Hi, I've a common function as shown below: public int ExecuteNonQuery(string text, params IDataParameter[] parameters) { DbCommand command = new SqlCommand(); command.CommandText = text; command.CommandType = type; command.Connection = conn; command.Transaction = null; foreach (IDataParameter parameter in parameters) { command.Parameters.Add(parameter); } return command.ExecuteNonQuery(); } public IDataParameter CreateParameter(string name, object value) { if (!name.StartsWith("@")) name = "@" + name; DbParameter parameter = new SqlParameter(name, value); if (value == DBNull.Value) parameter.IsNullable = true; return parameter; }  When I want to update records in a table, I usually invoke as shwon below:// Assume you've a connection object IDataParameter param = conn.CreateParameter("vendor_id", vendorId); string query = "UPDATE table SET status=4 WHERE vendor_id = " + param.ParameterName; conn.ExecuteNonQuery(query, param); This code works fine. But when I'm trying to update multiple records using IN clause, it does not work. Can any one tell me how to do it using IN clause? I need to update all vendors ava

Updating bunch of records at time

Hi, If I want to update 1000 records at a time in the database what is the best approach.Guide me Pls.

statement with SQL_C_WCHAR returns 22001 string data, right truncation error

I am trying to execute the following code  value = L"Test13Digit++"; SQLPrepare(stmt, L"delete Entries where [type] = ?", SQL_NTS); SQLBindParameter(stmt, paramNumber, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 100, 0, (SQLPOINTER) value.c_str(), 0, &strLen); SQLExecute(stmt); the table entries is as follows: Entries ([type] nvarchar(100), [key] nvarchar(100), [version] bigint, [data] varbinary(8000), CONSTRAINT PK_Entries PRIMARY KEY([type], [key]))   I keep getting the 22001 - string data, right truncation error. I have tried all different versions of WCHAR types but does not seem to help.

How do I create a query that joins two tables and returns a single entry with the most recent update


Say I have the following two tables (Purchase & Customer). 

CustomerID StoreName PurchaseDate
1 Asheville 9/14/2010 15:49
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend