.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

TableAdapter doesn't update the database

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

I have been working with business objects for quite a wihile but now have a need to use datasets in an application. I am unable to get the Tableadapter for the dataset to update the data in the database. The dataset is configured with an Update command, the database is an external sql server, Northwind db. I am watching this in sql profile, it reads the row, but no update is every executed. This is the code I am running:

            NWCustomer ds = new NWCustomer();
            NWCustomerTableAdapters.CustomersTableAdapter ta = new NWCustomerTableAdapters.CustomersTableAdapter();


            NWCustomer.CustomersRow r = ds.Customers[0];

            r["ContactName"] = "Maria Anders xxx";


View Complete Post

More Related Resource Links

update user status in database when ever user logoff


actually i came across this senario for new project where userstatus must change to log off when ever he do fallowing activity.I have maintain user status when he log in to web based system.

Activities are


1.user click log off

2.or user click browser close button or close brwoser tab.

3.or Fource fully shut down his Pc

I am able to get first 2 but not the last one.I googled it but not get any satified ans for that.

I m looking for guidens for this. Any help is grate help for me as i want it.And also other suggesstion also welcomed.

thanks in advance


execute update timedout expires , table with trigger due to recovery of database


I have table A in database A  , in table A i have trigger to insert record to database B table A, each update and insert of database A -table A, triiger fire and insert record in database B table A, when i try to update some times asp.net application gives error

"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."

and then error log says System.Data.SqlClient.SqlException: Database 'database B is being recovered. Waiting until recovery is finished.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean ret

Update Profile Database from text file using BDC



I have a requirement to import the profile properties from a text file in sFTP to update the MOSS Profile Database. The objective is to create a single repository for the Staff Directory in MOSS.

Can I use BDC to connect and update the Profile database?

What is the alternate approach?


Failed to update database "Hist_OHLC_ASnapshot" because the database is read-only.

Hi there, I've got this ExecutionfailureException using the subroutine below. It's been suggested by Alok.   public void CreateSnapshotAlok ( string SourceDatabaseName )         {             ProvideSecurity.provideSecurity ( );             DoServer.GetSrvConnOrSwitch ( "master" );             /* This is to ensure that a database with same name does not exist which is not needed if one chooses unique name for snapshot each time.*/             if ( Globals.srv.Databases[ SourceDatabaseName + "_Snapshot" ] != null )             {                 Globals.srv.Databases[ SourceDatabaseName + "_Snapshot" ].Drop ( );             }             Database database = Globals.srv.Databases[ SourceDatabaseName ];             Database snapshot = new Database ( Globals.srv, SourceDatabaseName + "Snaps

Sys.Data.DataContext.saveChanges method doesn't send update to server after DataServiceException ex

Hello,I have a page with a simple form that updates a single record in a table in my database.The database is accessed via WCF Data Services. To load and save data from/to the server, I usethe Sys.Data.DataContext object provided by the ASP.NET AJAX library. When the "save" button on theform is clicked, I use the saveChanges method of the Sys.Data.DataContext object to send all changes to the server.Also, at the server side, I use an interceptor that checks the "Price" fields of the record, and throws a DataServiceException exception when the contents of the field is a negative number.Both the JavaScript and the interceptor (in C#) are copied below.Here is the interesting thing:When I enter a negative price in the form, the interceptor throws the exception and my form shows an error message. Good.However, if I then make one of the other fields in the form a bit shorter (for example from "abcd" to "abc"),the saveChanges method doesn't send the data to the server. But it does call the success callback that I passed in to saveChanges, creating the impressionthat the data has been saved. This happens while the Price field is still negative. I used Fiddler to make sure thatno message is sent to the server. Also, the interceptor doesn't get executed.The weird thing is that if I make one of the fields a bit longer instead (for example &q

Update Database Schema without redeployment in Entity Framework

Hello. we build an app with 2 layers i.e the presentation and the Business layer which holds the business logic and have the entity framework provide us wtih entities. my question here is is there a way we can change the database schema and not have to redeploy the app to the client.  

toolStripStatusLabel.Text doesn't update?

I am able to set the toolStripStatusLabel.Text before showing the Form, but after the Form is shown then changing the status is not possible.I do have tried Application.DoEvents() but didn't help.Am using .Net/VS2005/C#. This works:Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);gui = new GUIForm();gui.StatusLabel = "Ready";Application.Run(gui); This doesn't works:Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);gui = new GUIForm();Application.Run(gui);gui.StatusLabel = "Ready";Application.DoEvents();

on submission the form doesn't write to the database

I have my code behind from my webform and it does everything but write to the database. The form comes up I can fill it out then click the button and it takes me to the thankyou.aspx page but no entry in the database. I can't find what I am doing wrong.using System;using System.Data;using System.Data.SqlClient;namespace orderfinal{    public partial class _Default : System.Web.UI.Page    {        protected void Page_Load(object sender, EventArgs e)        {        }        protected void btnSave_OnClick(object Src, EventArgs E)        {            if (Page.IsValid)            {                // Define data objects                SqlCommand comm;                // Open the connection                SqlConnection conn = new SqlConnection();     &n

Auto Binding Constraint doesn't update the UI

I needed a way to auto bind an activities inArgument to its parent activities delegateInArguments (property defined in an activity action). Picture dropping a WriteLine activity into an foreach<string> and having the foreach's argument automatically placed into the in argument of the writelines text property - binding it as it is dropped. I have created the constraint, and it works, including changing the binding to the parent or setting the property back to null if not in a parent.  My problem is that the UI doesn't reflect this.  It actually looks like it is doing nothing - I only know it works because it comes back correctly after a save and load of the workflow pattern. I'm guessing that I somehow need to refresh the model item? How do I refresh the model item from within a constraint? If it helps I have included the code for my constraint below, but note that my need is not as simple as the above example, so this does a couple of other things that don't make sense to this question. static Constraint CheckParent() { DelegateInArgument<GetTaskPermissionsActivity> element = new DelegateInArgument<GetTaskPermissionsActivity>(); DelegateInArgument<ValidationContext> context = new DelegateInArgument<ValidationContext>(); Variable<bool> result = new Variable<bool>(); Variable<

declarative #Bind doesn't bind in update command

I have a bunch of controls like the following in the EditItemTemplate of a ListView, with LINQDataSource:<asp:TextBox ID="Email" CausesValidation="true" EnableViewState="False" Font-Bold="false" Text='<%#Bind("Email")%>' BackColor="#FFFFFF" Enabled="true" TabIndex="50" runat="server" /> I'm curious to know why the database won't update on the click of the Update button:<asp:Button ID="btnUpdate" CommandName="Update" Text="Update" UseSubmitBehavior="False" TabIndex="170" runat="server" /> According to all I've read, the above code should be sufficient. Since CommandName is set to Update, it would seem that no code-behind is necessary.

Sharepoint Designer update which database

Whenever you are making changes using Sharepoint Designer, which content database is going to be update or which database maintain the information whenever you made the change thri sharepoint designer?

Update Database Record using GridView and Stored Procedure

Hi, I am trying to update record via stored procedure, but i got error at very start point. Problem is when i click on Edit link button within the Gridview it produce error. I can populate values from database fine but its produce error when i click on edit link button. Please see the code below. *********** ASP.net GridView Code I am using *****************<asp:GridView ID="GridView1" runat="server" DataKeyNames="RollID, EmpID" AutoGenerateColumns="False" Width="700px"> <Columns> <asp:TemplateField HeaderText="ApplicationID" Visible="false"> <ItemTemplate> <asp:Label ID="AppsID" runat="server" Visible="false"><%# Eval("RollID") %>'</asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="ReleaseID" Visible="false"> <ItemTemplate> <asp:Label ID="rlsID" runat="server" Visible="false"><%# Eval("EmpID") %></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Roll Name"> <ItemTemplate> <asp:Label ID="rlsVersion" runat="server"><%# Eval("Roll_Name")%></asp:Label> </ItemTemplate> <EditI

DataTable to update database

tbl.Columns.Add("COL1"); Hi all!Is it possible to construct a DataTable by yourself i.e. specify the column names and populate the data rows, and then update the back-end database?I am sending a list of objects of a same class to a DataTable:1. Lets say my class is :class step{int COL1;String COL2;int COL3;}2. I am sending an ArrayList of  above objects to a DataTablepublic DataTable GenTable(ArrayList listStep){DataTable tbl  = new DataTable();tbl.Columns.Add("COL1",i32);tbl.Columns.Add("COL2",String);tbl.Columns.Add("COL3",i32); }Now, finally, I need to update the back-end SQL Server database. How do I update that?thanks,Nick

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.

Reporting Services doesn't connect to database automatically

Hello. I use Windows 2003 R2 x64 and SQL Server 2005 x64.  The problem is: if the Reporting Services Service were doesn't start automatically, despite the set up parameter "Restart Automatically" every 1 minute in the service Recovery property. So every minute after Service stopped i recieve an error in Event Viewer: Report Server (MSSQLSERVER) cannot connect to the report server database However, after starting it manually from Computer Management->Services or Reporting Services Configuration Tool it starts normally without any error. I use local system admin account to start Services and to connect to Database. Both parameters are set using RS Configuration Tool. Will be thankful for any advice.

Refresh update panel when database changes

I have an admin page in which I need to change the list whenever a user signs up on our web site.How can I put and event to MySql database so that whenever the count of  a table row changes it refreshes my update panel for me to see the new user.

Update in formview doesn't work, but I don't get an error message?

I have a datasource:<asp:SqlDataSource ID="MySQLProfielDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:WAPMySQLConnStr %>" InsertCommand="INSERT INTO usergegevens(UserId, Geslacht, Voornaam, Tussenvoegsel, Achternaam, Adres, Huisnummer_toev, Postcode, Woonplaats, TelnrV, TelnrM, Geboortedatum) VALUES (@Param1, @Param2, @Param3, @Param4, @Param5, @Param6, @Param7, @Param8, @Param9, @Param10, @Param11, @Param12)" ProviderName="<%$ ConnectionStrings:WAPMySQLConnStr.ProviderName %>" SelectCommand="SELECT UserId, Geslacht, Voornaam, Tussenvoegsel, Achternaam, Adres, Huisnummer_toev, Postcode, Woonplaats, TelnrV, TelnrM, Geboortedatum FROM usergegevens WHERE (UserId = @Param1)" UpdateCommand="UPDATE usergegevens SET Geslacht = @Param1, Voornaam = @Param2, Tussenvoegsel = @Param3, Achternaam = @Param4, Adres = @Param5, Huisnummer_toev = @Param6, Postcode = @Param7, Woonplaats = @Param8, TelnrV = @Param9, TelnrM = @Param10, Geboortedatum = @Param11 WHERE (UserId = @Param12)" onselecting="MySQLProfielDataSource_Selecting" onupdating="MySQLProfielDataSource_Updating" onselected="MySQLProfielDataSource
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