.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

How to save the edits made at runtime in the datatable

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Windows Application
Hi, I am having problem in updating the contents of my datatable in datagrid. When i run the program and edit the contents of the rows in my datatable they remain there, but when i close the program and run it once more they are set back to their original predefined contents. Please tell me that how can i save the edits made at runtime in my datatable. 

View Complete Post

More Related Resource Links

System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Excel cannot open or save any mo


Hello good people, 

I have this beast as an error. Did my research and found some posts here as well but did not do any good for me. 

Here is what I did. I had an error regarding issue rights with COM objects so I gave access rights under component services for Microsoft Excel application now I am getting this error. 

Here is some information regarding this

1. Gave rights to ASPNET and network service to my web app directory to try to fix this error. 

2. The exact same process works on my Windows 2003 server and my Windows 7 development machine. I am trying to get this going on a different windows 2003 machine that is outside of our domain.

3. Developing on windows 7 64 bit with office 2010 installed. Also excel 2010 is installed on my Web server

4. Here is the code that is causing the error: The last line is causing the error.:

            MyXl = new Microsoft.Office.Interop.Excel.Application();
            MyXl.Visible = false;
            MyWb = (Microsoft.Office.Interop.Excel._Workbook)(MyXl.Workbooks.Add(Missing.Value));
            int test = 0; 
            MySheet = (Microsoft.Office.Interop.Excel._Worksheet)MyXl.ActiveSheet;
            if (reader.HasRows)
                int InRow = 2; 
                for (int i = 0; i < Nu

cannot get the crystalreport1.rpt to recognize the change made to the datatable, help..

added a dataset.xsd file, kept a datatable in it, nothing elsebinded the dataset as a datasource for the srystalreport1.rptnow my aim is to, make the dataset populated by code to appear in the report (note the gridview does recongize the change, also note i have tried using the init page method but no luck)heres the code behind.        DataSet1 ds = new DataSet1();        //DataTable dt;        DataRow dr;        DataColumn idCoulumn;        DataColumn nameCoulumn;        int i = 0;        //dt = new DataTable();        idCoulumn = new DataColumn("ID", Type.GetType("System.Int32"));        nameCoulumn = new DataColumn("Name", Type.GetType("System.String"));        ds.DataTable1.Columns.Add(idCoulumn);        ds.DataTable1.Columns.Add(nameCoulumn);        dr = ds.DataTable1.NewRow();        dr["ID"] = 1;        dr["Name"] = "Name1";        ds.DataTable1.Rows.Add(dr);        dr = ds.DataTable1.NewRow();   &nb

How to save and update the contents in a datatable

Hi, I am having problem in updating the contents of my datatable in datagrid. When i run the program and edit the contents of the rows in my datatable they remain there, but when i close the program and run it once more they are set back to their original predefined contents. Please tell me that how can i save the edits made at runtime in my datatable. This is the code for my program. Please review it first: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;   namespace WindowsFormsApplication5 {     public partial class Form1 : System.Windows.Forms.Form     {         private System.ComponentModel.Container components;         private Button button1;         private Button button2;         private DataGrid myDataGrid;         private DataSet myDataSet;         private bool TablesAlreadyAdded;         public Form1()         {             // Required for Windows Form Designer support.             InitializeComponent();        &n

How to save settings in wpf runtime

I am making a wpf webBrowser application. My problem is: This is probley very easy, but i can't figure it out for the life of me! How can i save eveything like history and bookmarks so that when the program is closed it opens up as  the user closed it, with bookmarks and history still there? Thanks in advance!

how can we split a datatable into two ,based on a column at runtime

hi , ihave a problem that to assaign values to two listviews from single datatable based on a column which have values 0, 1. it is wpf app the listview has a grid . i need to specify the result data as datacontext

Edit workflow at runtime save in db and restart on per client basis

I need to be able to create a workflow in code (not a problem). Start the workflow and edit it depending on business logic (Add Parallel branches) save workflow in database per client. Pull workflow defintion from database by client and continue to work and persist as workflow progreeses. I thought XamlServices or ActivityXamlServices but i can't seem to get to the individual activities to edit.

how to add row in datatable at runtime (C#- Coding)


I am create a row in datatable and it displays in gridview,

upto this working very fine.............

i am getting rows input from txtbox.

but when i try to add one more row at runtime it will overwrite and displaying the current inserted value but

i need to add as a next row and so on.....

 check my code........

DataTable dt = new DataTable("tblTest");

DataRow dr;

dt.Columns.Add("Name", typeof(string));

dt.Columns.Add("Add1", typeof(string));


STSADM import fails with "FatalError: Save Conflict Your changes conflict with those made concurrent


MOSS 2007

I am importing a relatively large (10 GB) subsite and getting the following error:

[4/7/2011 9:05:05 AM]: FatalError: Save Conflict

Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.
   at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)
   at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents)
   at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut,

Save Workflow Runtime as Application State or Session State for a website with multiple users?


I used Windows Workflow Foundation 3.5 as a page flow navigation for a ASP.NET website's Previous and Next page navigation.

The site acts like a shopping cart and each user has his own session and user data.  The app only has one WF.  I am not sure if I should generate one Workflow Runtime for every user or for simply generate one workflow Runtime for the entire application in my case?   

In the global.asax:

void Application_Start(object sender, EventArgs e)

void Application_End(object sender, EventArgs e)
    void Session_Start(object sender, EventArgs e)
        // Code that runs when a new session is started
        System.Workflow.Runtime.WorkflowRuntime workflowRuntime = new System.Workflow.Runtime.WorkflowRuntime(WorkflowManager.WorkflowRuntimeKey);


Ready made List Types provided by SharePoint

SharePoint provides some out of the box List Types. Some of the most used ready made list types that SharePoint provides currently are listed below:

Create And Run Excel Macro At Runtime in C#

You've been tasked with writing a Windows Form application using the .NET Framework that interacts with Microsoft Excel. If you are new to working with Excel in .NET and are having trouble learning how to format certain cells or cell ranges, then this little tip will come in handy. Rather than scour the internet hoping to find the correct set of constants or method syntax for formatting your spreadsheet, use the built in tools in Excel to write the familiar VBA code for you. Then, you can paste the VBA code generated by Excel into the sample C# code below and run it dynamically at runtime.

Save images to SQL CE

Storing binary objects (such as image, office document etc.) into database is a little cumbersome when it comes to retrieval. Hence the most commonly accepted way is only store the file path in the database, and to store the documents on a file share.

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

DataTable - Load from IDataReader - CreateDataReader - ReadXml WriteXml - Free ADO.NET Tutorials

The DataTable in ADO.NET 2.0 has been seriously beefed up and I absolutely love it. Not everything we consume deals with multiple resultsets and requires the ever popular DataSet. With the cool new features in the ADO.NET 2.0 DataTable, we can get many of the cool features in the DataSet without all the extra baggage and memory footprint particular to multiple resultsets.

Load DataTable from IDataReader

How to Localize Windows Forms and Change the Language at Runtime

Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Profile not being save after redirect.



I am trying to save values into a Profile on Page1, then redirect to Page2 and access those values.  However, after the page redirects the profile values are blank as if they were never saved.   When stepping through the code I can see that they are being save on Page 1.

I suppose I could use session variables to store the information but I don't understand why saving the profile doesn't work.

private void PayWithPayPal()
        ProfileCommon profile = this.Profile;

        if (Global.CurrentUserName.Length > 0)
            profile = this.Profile.GetProfile(Global.CurrentUserName);
        profile.FirstName = uxFirstNameShipping.Text;
        profile.LastName = uxLastNameBilling.Text;
        profile.ShippingAddress.AddressLineOne = uxAddressLineOneShipping.Text;
        profile.ShippingAddress.AddressLineTwo = uxAddressLineTwoShipping.Text;
        profile.ShippingAddress.City = uxCityShipping.Text;
        profile.ShippingAddress.State = uxStateShipping.Text;
        profile.ShippingAddress.ZipCode = uxPostalCodeShipping.Text;

        Response.Redirect("~/expresspayment.aspx", false);

protected void Page_Load(object sender, EventArgs e)
        ProfileCommon p

Datatable in session


I am creating a simple shopping cart using a datatable that is passed into a session object.  I have a small mini cart that displays the total number of items in the cart as well as the running total - this is displayed in a web control.  When the web control starts up I run a try/catch to see if the session object exists, if it doesn't I create the datatable for the cart and store it in the session.  I then have a datalist control that contains all the information for my products including an "add to cart" button.  When the page loads everything looks fine.  If I click on an "add to cart" button nothing happens to the session information.  If I click on it again, the session information updates - displaying only one item is in the cart and then counts up correctly there after.  Additionally, after adding an item, if I select a different item in the list, the same issue occurs.  I am not sure why this is happeing, if anyone can give me an idea I would appreciate it. 

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