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

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

Best way to update database from excelfile

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


I have a problem with updating data in database from importing excelfile. What I want is:

1.Export table in database to excelfile

2. Make changes in excelfile

3. Via asp.net web form upload file, do some validation, and update table in database with changes from excelfile.

I have written code to get the current data to a dataset. Also been able to get the exceldata in to another dataset.

When I try to copy the datatable in the first dataset to the other( dataset ds1 = ds2.copy() )and then tries to do an sqldataadapter.update(). The changes are not updated in database.

Is this the wrong approach? Is it better to read the excelfile into a dataset. Truncate table in database and loop through each records in databable and do a sql insert?




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

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.  

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.

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.

Fileupload with database parameters that need to return nothing on update

Hi All, Got a problem with regards to the file upload control on database updates. The problem is in my CMS, when a user tries to update content for a page it will add null to the fields containing the image path. What I need is for the system to check if the uploader has no image and if hasn't it has to do nothing. It can't add empty strings or null values as this will remove the original image path. Although they still need to be able to do image updates if the uploader has a file(this bits not a problem). Heres a snipet of code to demonstrate what I'm trying to achieve. protected void Button1_Click(object sender, EventArgs e) { if (Page.IsPostBack) { AddMenu menu = new AddMenu(); string APP_PATH = Server.MapPath(Common.GetAppSetting("_MENU_PATH")); if (FileUpload1.HasFile == false) { menu.Menu_Image1 = /////// Its this bit that has to do nothing //// Menu_Image1 calls a Parameter on the data layer /// Ie cmd.Parameters.AddwithValue("@image", _menu_image1) } else if (FileUpload1.HasFile) { if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.ContentLength > 0) { Uploa

How to update database of wpf client applications ??

Hi, I have a WPF Windows application with sqlite database which we distribute to our clients. The application consists of some database table which changes every month. eg. the application users a  exchange rate table which is valid for one month. What is the best approach to update the data in these table. Please note that the whole application is not changing but only the data in it changing, no change to structur of the database or table. Please guide me with some options how I can achieve this task. Thank You. Mohamed Ziyad

Start workflow on database update

HiIs there a way to start a workflow when something in a database has changed (e.g. a row was added)? I am looking for something similar to a Receive activity, but which monitors parts of a database.Could that be achieved by having a "master" workflow that spins off sub-workflows?ThanksAlex

How To Update Database When The System Shut Down By Light Problem

Hi,I want to update the User LoggedIn Status to 'False', when the system shut down by light problem, or when the user click the 'Browser Close Button'Please help me in details.Thanks in advance.

how to periodically update database file of my wpf application?

Hi, I have a WPF Windows application which we distribute to our clients. The application consists of some database table which changes every month. eg. the application users a  exchange rate table which is valid for one month. What is the best approach to update the data in these table. Please note that the whole application is not changing but only the data in it changing. Please guide me with some options how I can achieve this task. Thank You. Mohamed Ziyad

How do I update a normalised database table


Hi, I am a hobbyist learning SQL and .asp and am using Visual Web Developer Express 2008 to produce a website for a sports club. 

I have created normalised data tables to hold look up information (such as venues, players, teams etc) and want to dynamically update the 'matches' data table (my transactions) using webpages instead of running SQL queries.

What I want to do is select a name from a drop down list and then post the relevant ID associated with that name to my 'matches' table. At the moment I can only link to the value in the drop down list, i.e. the name which is incompatible with the validation which expects a primary key integer.

I'm sure this problem is a fairly common one but I haven't found the right answer on any of the tutorials or blogs, all of them assume that the data is de-normalised or describe things in more technical ways than I can yet understand. If anyone can point me to a 'how to article' or tell me what I am doing wrong, I would be grateful.

Update remote sql server database from local sql server database.


Hi all,

I have a local database which is updated regularly. Now I need a good way to reflect the local database changes into the remote sql server. Both the server have same database structure.

All the above pocess should work automatically from the local database server because I need to update the remote one so that the website visitor can get the updated results in the morning.

I need a detailed description/ procedure to accomplish the work.

Tanks in advance.



Web Developer


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