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

Post New Web Links

Statments not updating one column

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :ASP.Net

This function is a virtual copy and paste from another function working just fine.  It updates two columns in the database. One is a date and the other is a byte.

My working function

Public Function UpdateAdvLink(ByVal advlink As Integer) As Boolean
        Dim con As New SqlConnection(DataFuncs.GetConnectionString)
        'Dim con As New SqlConnection("Server=SCOT\SQLEXPRESS;Initial Catalog=linkexchanger;Integrated Security=True;Connect Timeout=8")
        'Response.Write("we made it here")
        ' Exit Function
        Dim Numemails As Integer
        Dim adv As New AdvanceLink(advlink)

        If Not IsDBNull(adv.TimesEmailed) Then
            Numemails = adv.TimesEmailed
            Numemails = Numemails + 1
        Else : Numemails = 1
        End If

        Const sSQL As String = "UPDATE tblAdvanceLink SET LastEmailed = @LastEmailed,TimesEmailed = @TimesEmailed WHERE ADVLinkID =  @ADVLinkID"
        Dim xSqlCommand As SqlCommand = New SqlCommand(sSQL, con)

            xSqlCommand.Parameters.Add("@LastEmailed", SqlDbType.DateTime)
            xSqlCommand.Parameters("@LastEmailed").Value = DateTime.Today
            xSqlCommand.Parameters.Add("@TimesEmailed", SqlDbType.Int)

View Complete Post

More Related Resource Links

Question in row group not updating on when the column value changes

I'm using Report Builder 3.0 and created a row group column and then moved it to a row about the detail columns instead of leaving it as a column at the left.  When I run the report the group value doesn't change  but the page break occurs.  I added the same field as a column so I can see the value is different. Why is the row group field not changing?

Updating column DisplayName


Hello, I've got a question concerning the updating of a column in a list. This list has an inherited site content type in it, which has the Title column. The column is actually renamed in the content type, but when this is deployed to a new list, the column is called Title again (a known problem). So I now try to rename the Title column with the DisplayName property.

The following code works:



SPFieldLink titleFieldLink = derivedCType.FieldLinks[new

Updating "Modified By" Column Via SharePoint Web Services


Here is my situation:  I have a web app running on a non-SharePoint machine that uses the SharePoint web services (specifically, the Copy web service) on another box to shoot documents to the Shared Documents library.  That works all fine and dandy.  Then a requirement came in that fields need to be updated when the document is uploaded.  Again, not much problem there.  However, then a requirement came in where they wanted the user's name displayed in the "Modified By" column.  When documents are currently uploaded, the "Modified By" column displays the name of the resource account that the web app runs under on the remote machine.  This isn't really helpful to users.  They want to know the name of the user who uploaded the document, not the resource account they were impersonating in order to upload the document.  Is it possible to accomplish this using the FieldInformation class that accompanies the Copy web service provided by SharePoint?  I tried something like the following but it did not work:

fieldInfo = new SPCopyWS.FieldInformation();
fieldInfo.Type = SPCopyWS.FieldType.Text;
fieldInfo.DisplayName = "Modified By";
fieldInfo.Value = "Ruslander, Andrew";

Updating values of one column of table 1 from a different table


Hi I need to update one column with the values from a column from a different table joined by the subtypes. Please see below...







PRODUCT =(dbo.[Subtype-desc$].[Subtype-description])

Error adding/updating Indexed Column to Upgraded Site


We get the following error when adding or updating an indexed column on an upgraded Discussion Board list (from 2007):

System.ArgumentException: Value does not fall within the expected range.


10/18/2010 11:26:22.56 	w3wp.exe (0x1F10)            	0x13EC	SharePoint Foundation     	Monitoring          	nasq	Medium 	Entering monitored scope (Request (POST:http://SERVER:80/SUBSITE/_layouts/EditIndex.aspx?List=544ad227-32bf-4d68-88e6-1a84eb761e8b))	 
10/18/2010 11:26:22.56 	w3wp.exe (0x1F10)            	0x13EC	SharePoint Foundation     	Logging Correlation Data   	xmnv	Medium 	Name=Request (POST:http://SERVER:80/SUBSITE/_layouts/EditIndex.aspx?List=544ad227-32bf-4d68-88e6-1a84eb761e8b)	66aa366d-ac57-4d3f-85b7-9ed0da55f878
10/18/2010 11:26:22.56 	w3wp.exe (0x1F10)            	0x13EC	SharePoint Foundation     	Logging Correlation Data   	xmnv	Medium 	Site=/	66aa366d-ac57-4d3f-85b7-9ed0da55f878
10/18/2010 11:26:22.90 	w3wp.exe (0x1F10)            	0x13EC	SharePoint Foundation     	Runtime            	tkau	Unexpected	System.ArgumentException: Value does not fall within the expected range.  at Microsoft.SharePoint.SPFieldIndexCollection.Add(ArrayList fields)   at Microsoft.SharePoint.SPFieldIndexCollection.Add(SPField primaryField, SPField secondaryField)   at Microsoft.SharePoint.ApplicationPages.EditIndexPage.CreateIn

Problem updating a managed metadata column value



I have a document library where I've added a managed metadata column that contains a list of city names.
So far so good, I can add documents and set a value for this column.

The problem starts when modifying a city name. E.g. I change New York into Washington.
All items that were linked to New York will still show New York and not Washington.
When adding a new document I can pick Washington from the list of cities, but in my view it will still show New York (even though I picked Washington and there is no sign of New York in the values). When opening "view properties" it will still show New York. When opening "edit properties" it will show Washington.

This is very confusing to users (and also for me)!
Is there a timer job or something that should run before all items will use the correct updated value ?

Updating 1 column in EntityFramework.


I have Create and Edit forms for Categories.
Columns are Id, CategoryName, Order, CreatedOn.
On Create form I save the values for all but on Edit form I need to change only CategoryName. Below is the code. Problem is that on Edit form only CategoryName field exists which on submit button is passed to Edit Action. Whenever I update Order and CreatedOn becomes null because the values are not returned from form. Someone tell me any good approach how to Updated selected values in EF. Below is code.

Making multiple Get calls. Form is saving fine but I don't like the approach. Need clean approach. Anyone got better solution to thiis?

 <% using (Html.BeginForm()) {%>
                <div class="editor-label">
        <%: Html.LabelFor(model => model.CategoryName) %>
    <div class="editor-field">
        <%: Html.TextBoxFor(model => model.CategoryName) %>
        <%: Html.ValidationMessageFor(model => model.CategoryName, "*")%>
                <input name="confirmSubmit" type="submit" value="Update"  />

    <%} %>


updating attachment in a versioned list with a multi-choice column produces extra versions?


the issue is that I can reproduce it consistently and also replicated it in a test site: if a list with versioned and attachments has a multi-choice column with choices from a list in the same site, when you make changes to attachments, then updating the item properties not including the multi-choice column you will get that issue – updates persisted but two versions created the older one with the multiple choice column set to empty and the new one set right.

If the issue happens, workflows associated with the item will not be triggered. If you follow the procedure listed below, the issue will go over. And then workflows will work.

for the sql error behind see another thread: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/f223d664-59e4-45f1-8553-20040c3e0d8c


updating auto incremental sequence number in a column



can anybody tell me the quickest and perfect way to update the column with auto incremental sequence number without using cursor,while loop,temp table and using identity column, if possible in a single update statement.

I want output like







can this be possible in single update statement. Note that initially all the values in column col1 are either zero ar NULL



Sachin :)

ADO RecordSet Update Fails (Insufficient key column information for updating...)


Hi, I'd like to update one field in a recordset but I'm getting this error:

*** insufficient key column information for updating or refreshing" ***

My program consists in a .VBS file (VbScript), and the code goes as follows:

connectionString = "Provider=SQLNCLI; DataSource=dbABC;Initial Catalog=whateverCat;Integrated Security=SSPI"

set objConn = CreateObject( "ADODB.Connection" )
set objRs = CreateObject( "ADODB.RecordSet" ) objConn.ConnectionTimeout = 0
objRS.CommandTimeout = 0
objRS.CursorLocation = 3 ' adUseClient
objRs.LockType = 3 ' adLockOptimistic
objRs.CursorType = 2 'adOpenDynamic
objConn.Open ConnectionString
objRs.Open "Select ComputerID, ComputerName From ComputerTable", objConn
do until objRs.eof
objRs( "ComputerName" ).Value = "NewComputerName"
objRs.Update ' ****Fails here

I don't need that the changes made in the RecordSet to be propagated into the DB table, so perhaps here is my problem: I do only have read access to the tables. Could this be the problem? Thanks.

Tooltip for GridView Column Headers (ASP.Net)

I just wanted to add auto tooltips for my GridView headers. There are couple of ways but I don't want to use javascript and wanted to use simple 'title' attribute. It took couple of hours to get the working code supporting sortable columns. I thought it will be very useful for others. Here's the code and logic behind it.

Multiple Column Dropdownlist for the ASP.NET DataGrid

Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

Alternating row background for first column of a report


is there a way to make the first column of a report use the an alternating background color? 

I have the background color set for the entire row however it does not work for the first column if the color is set to an expression.  If I just set it to a color i.e. red it works just fine. If I insert a dummy column to the left it works just fine (but the dummy column does not work, presumably because it is first??).

In the file below only the textbox for part number does not show an alternating background.  All others work correctly.

                    <Textbox Name="PartNumber">

Use a column as parameter for a sds in another column; gridview


Hola, I have a gridview which is bound to a sds which returns 7 columns and I added two columns from the GUI.  What I want is to fill up the 9th column with DDLs and these  DDLS will get their data from a different sds which is using a stored procedure with a single parameter.  I created the 9th row, used template field, made the sds for 9th row, the stored_procedure, threw a DDL in Item template and all  I need now is to pass a parameter in the first column to the sds in the 9th column.  I can code this but i'm getting tired of aspx.cs :) and would like to do it from the GUI.

Pass a grid column value to a Modal


Hi, I have a requirement to hide a field called details on a gridview and show it in a jQuery modal dialog when users click on the Customer ID hyperlink. This grid is created programmatically. I will be hiding the details column via the CSS display:none property. Does some one know how can I pass the grid's selected hidden column value to the modal? Here is some of the code I started:

            GridView mygrid = new GridView();
            //.....................................More columns code for the grid

            //Here is where I need to pass the Details column value associated with the customer ID field selected to the Modal and open the Modal dialog.            
            HyperLinkField linkField = new HyperLinkField();
            string[] dataNavigateUrlFields = { "CustomerID" };
            linkField.DataTextField = "CustomerID";

Bug: Does not change column type from nvarchar to ntext


Scenario: If you create a table with a column of type nvarchar, populate it with some content and try to modify it using the WebMatrix editor, from nvarchar to ntext, it does not display any error message or warning that this is not possible. It silently saves and reverts the change, back to nvarchar. Wasted some hours on this issue as I thought my column was ntext, but in fact was still nvarchar.

Expected behavior: It should change to ntext, or if SQL CE doesn't support that, it should notify the user that no change was applied.

Display column from child table. Possible ?



I'am using dnamic entity with EF4. On a list page of a table, I would like to display a column containing information from a child table of the current element. Sample :

Order List :

Order Data | Required Date | Shipped Date | etc... | ... | Customer Name (foreign key with tostring() method override) | Customer Postal Code (Column that I want to add) |

I don't known how to do that. Is it possible ? Maybe I have to to create my own Metadata proxy that will add dynamicly a column on the MetaColumn list of the table.

Does someone have an easier or better idea ?

Thank you for any help.

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