473,416 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

using EXCEL SHEET with ASP.NET

Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud
Nov 19 '05 #1
14 5725
pmud wrote:
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of a
button.


Hey pmud,
Have a look at this (watch for wrapping)
http://msdn.microsoft.com/library/de...hiteRabbit.asp

You may need Office Tools for Visual Studio - don't know if you can download it.

--
Software is like sex: it's better when it's free -- [Linus Torvalds]

Fabio Marini - A+, RHCT, MCDBA, MCAD.NET
To reply: news [at] mamakin1976 [dot] plus [dot] com
Nov 19 '05 #2
Hi Fabio,

I already have the Visual Studio.Net Enterprise Edition. Thses office tools
come with it. But i dont think these were installed coz the server already
had MS Excel installed on it. Are thses tools something different?

"Fabio" wrote:
pmud wrote:
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of a
button.


Hey pmud,
Have a look at this (watch for wrapping)
http://msdn.microsoft.com/library/de...hiteRabbit.asp

You may need Office Tools for Visual Studio - don't know if you can download it.

--
Software is like sex: it's better when it's free -- [Linus Torvalds]

Fabio Marini - A+, RHCT, MCDBA, MCAD.NET
To reply: news [at] mamakin1976 [dot] plus [dot] com

Nov 19 '05 #3
Your best bet would be to create a Web service with ASP.NET and have users
access it using Excel on their desktop.

How To Use an XML Web Service by Using ASP.NET from an Office VBA Macro in
Word or Excel

"This article demonstrates how to use an XML Web service using ASP.NET from
a Visual Basic for Applications (VBA) macro in Word or Excel. "

http://support.microsoft.com/default...b;en-us;307033

http://msdn.microsoft.com/library/de...l/odc_xlws.asp

http://www.codeproject.com/vb/net/Webservices.asp

Ken
Microsoft MVP [ASP.NET]
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud


Nov 19 '05 #4
I need to code in C#. Could you please tell me some site for C# & not VB?

Thanks

"Ken Cox [Microsoft MVP]" wrote:
Your best bet would be to create a Web service with ASP.NET and have users
access it using Excel on their desktop.

How To Use an XML Web Service by Using ASP.NET from an Office VBA Macro in
Word or Excel

"This article demonstrates how to use an XML Web service using ASP.NET from
a Visual Basic for Applications (VBA) macro in Word or Excel. "

http://support.microsoft.com/default...b;en-us;307033

http://msdn.microsoft.com/library/de...l/odc_xlws.asp

http://www.codeproject.com/vb/net/Webservices.asp

Ken
Microsoft MVP [ASP.NET]
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud


Nov 19 '05 #5
http://support.microsoft.com/kb/308359/EN-US/

"pmud" <pm**@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
I need to code in C#. Could you please tell me some site for C# & not VB?

Thanks

"Ken Cox [Microsoft MVP]" wrote:
Your best bet would be to create a Web service with ASP.NET and have
users
access it using Excel on their desktop.

How To Use an XML Web Service by Using ASP.NET from an Office VBA Macro
in
Word or Excel

"This article demonstrates how to use an XML Web service using ASP.NET
from
a Visual Basic for Applications (VBA) macro in Word or Excel. "

http://support.microsoft.com/default...b;en-us;307033

http://msdn.microsoft.com/library/de...l/odc_xlws.asp

http://www.codeproject.com/vb/net/Webservices.asp

Ken
Microsoft MVP [ASP.NET]
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
> Hi,
>
> I need to use an Excel Sheet in ASP.NET application so that the users
> can
> enter (copy, paste ) large number of rows in this Excel Sheet. Also,
> Whatever
> the USER ENETRS needs to go to the SQL DATABASE, probably by the click
> of
> a
> button.
>
> Is this possible? & what is the BEST APPROACH for doing this? & also if
> any
> links are there do tell those to me too coz I have no idea how to go
> about
> doing it.
>
> Thanks
> --
> pmud



Nov 19 '05 #6
pmud wrote:
I already have the Visual Studio.Net Enterprise Edition. Thses office tools
come with it. But i dont think these were installed coz the server already
had MS Excel installed on it. Are thses tools something different?


No, I don't think so. Didn't know they come with the Enterprise version of VS -
good to know...

Have fun!

--
Software is like sex: it's better when it's free -- [Linus Torvalds]

Fabio Marini - A+, RHCT, MCDBA, MCAD.NET
To reply: news [at] mamakin1976 [dot] plus [dot] com
Nov 19 '05 #7
This 3rd party product provides the functionality you need:
http://www.aspose.com/Products/Aspose.excel/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud

Nov 19 '05 #8
Hi Ken ,
I saw the link u gave me for WEb services & C#. But can you please explain a
little in detail. I basically need the user to see an Excel sheet in an
application. In this excel sheet the user can copy & paste rows of data &
when he clicks a buttton, this data FROM Excel SHEET should go to SQL
DATABASE.

I searched a lot on net also but only found ways to export data TO excel
sheet & not how to do it the other way round. I am new to ASP.NET & C# & have
never used WebService before too. I would be grateful if you could help.

Thanks
"Steve C. Orr [MVP, MCSD]" wrote:
This 3rd party product provides the functionality you need:
http://www.aspose.com/Products/Aspose.excel/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud


Nov 19 '05 #9
Hi Steve,

I dont want to purchase Aspose. I have MSDN Universal SUbscription. Earlier,
in a hurry I wrote that i have the Enterprise edition.But I have MSDN
Universal.I dont think I want to buy anythg else now. But if you could please
suggest in what way can I give the users the functionality of copying &
pasting rows of data so that they can go to the database. By using text boxes
, the user can enter only one record at a time which can be very time
consuming. I would be glad if you could help.
"Steve C. Orr [MVP, MCSD]" wrote:
This 3rd party product provides the functionality you need:
http://www.aspose.com/Products/Aspose.excel/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud


Nov 19 '05 #10
Hi Ken,

As suggested by you I created a Web Service with ASP.NET & an Excel
Application Which would use this Web SErvice. But I am getting error in the
WEB SERVICE & the Excel Project too. PLEASE HELP!

MY CODE IS ::: WEB SERVICE::

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;

namespace SQLQuery
{
/// <summary>
/// Summary description for Service1.
/// </summary>
public class Service1: System.Web.Services.WebService
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}

private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlCommand sqlCommand1;

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlCommand1 = new System.Data.SqlClient.SqlCommand();
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=TRIOEX;packet
size=4096;user id=sa;data source=TRIOEX;persist secu" +
"rity info=True;initial catalog=Sorting;password=icode";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table",
"Sort", new System.Data.Common.DataColumnMapping[] {
new
System.Data.Common.DataColumnMapping("Company", "Company"),
new
System.Data.Common.DataColumnMapping("Ceo", "Ceo"),
new
System.Data.Common.DataColumnMapping("Month", "Month")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = "DELETE FROM Sort WHERE (Company =
@Original_Company) AND (Ceo = @Original_Ceo OR " +
"@Original_Ceo IS NULL AND Ceo IS NULL) AND (Month = @Original_Month OR
@Original" +
"_Month IS NULL AND Month IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_Comp any",
System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "Company",
System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_Ceo" ,
System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "Ceo",
System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_Mont h",
System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "Month",
System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO Sort(Company, Ceo,
Month) VALUES (@Company, @Ceo, @Month); SELECT Com" +
"pany, Ceo, Month FROM Sort WHERE (Company = @Company)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Company", System.Data.SqlDbType.VarChar,
10, "Company"));
this.sqlInsertCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Ceo", System.Data.SqlDbType.VarChar, 10,
"Ceo"));
this.sqlInsertCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Month", System.Data.SqlDbType.VarChar,
10, "Month"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT Company, Ceo, Month FROM
Sort";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Sort SET Company =
@Company, Ceo = @Ceo, Month = @Month WHERE (Company = @Original_Company) AND
(Ceo = @Original_Ceo OR @Original_Ceo IS NULL AND Ceo IS NULL) AND (Month =
@Original_Month OR @Original_Month IS NULL AND Month IS NULL); SELECT
Company, Ceo, Month FROM Sort WHERE (Company = @Company)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Company", System.Data.SqlDbType.VarChar,
10, "Company"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Ceo", System.Data.SqlDbType.VarChar, 10,
"Ceo"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Month", System.Data.SqlDbType.VarChar,
10, "Month"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_Comp any",
System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "Company",
System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_Ceo" ,
System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "Ceo",
System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_Mont h",
System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "Month",
System.Data.DataRowVersion.Original, null));
//
// sqlCommand1
//
this.sqlCommand1.CommandText = "INSERT INTO Sort (Company) VALUES (@a)";
this.sqlCommand1.Connection = this.sqlConnection1;
this.sqlCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@a", System.Data.SqlDbType.VarChar, 10,
"Company"));

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion


[WebMethod]
public string DbEntry()
{
return (sqlCommand1.Parameters["@a"].Value=obj.rng);

}
}
}
BUT I AM GETTING THE ERROR::
C:\Inetpub\wwwroot\DEMO\SQLQuery\Service1.asmx.cs( 134): The type or namespace
name 'My_Excel_Chart_Options' could not be found (are you missing a using
directive or an assembly reference?)

MY EXCEL PROJECT CODE IS ::

using System;
using System.Windows.Forms;
using Office = Microsoft.Office.Core;
using Excel = Microsoft.Office.Interop.Excel;
using MSForms = Microsoft.Vbe.Interop.Forms;

// Office integration attribute. Identifies the startup class for the
workbook. Do not modify.
[assembly:System.ComponentModel.DescriptionAttribut e("OfficeStartupClass,
Version=1.0, Class=My_Excel_Chart_Options.OfficeCodeBehind")]

namespace My_Excel_Chart_Options
{
/// <summary>
/// Contains managed code extensions for the workbook.
/// </summary>
public class OfficeCodeBehind
{

/// <summary>
/// Application object.
/// </summary>
internal Excel.Application ThisApplication
{
get { return thisApplication;}
}

/// <summary>
/// Workbook object.
/// </summary>
internal Excel.Workbook ThisWorkbook
{
get { return thisWorkbook;}
}

private Excel.Application thisApplication = null;
private Excel.Workbook thisWorkbook = null;

private Excel.WorkbookEvents_OpenEventHandler openEvent;
private Excel.WorkbookEvents_BeforeCloseEventHandler beforeCloseEvent;

private MSForms.CommandButton btn;
public Excel.Worksheet ws = (Excel.Worksheet)ThisWorkbook(Worksheet[1]);
public Excel.Range rng;//,rng1,rng2;
//public Excel.Range rng1;

#region Generated initialization code

/// <summary>
/// Default constructor.
/// </summary>
public OfficeCodeBehind()
{
}

/// <summary>
/// Required procedure. Do not modify.
/// </summary>
/// <param name="application">Application object.</param>
/// <param name="workbook">Workbook object.</param>
public void _Startup(object application, object workbook)
{
this.thisApplication = application as Excel.Application;
this.thisWorkbook = workbook as Excel.Workbook;

openEvent= new Excel.WorkbookEvents_OpenEventHandler
(ThisWorkbook_Open);
thisWorkbook.Open += openEvent;

beforeCloseEvent = new
Excel.WorkbookEvents_BeforeCloseEventHandler(ThisW orkbook_BeforeClose);
thisWorkbook.BeforeClose += beforeCloseEvent;
}

/// <summary>
/// Required procedure. Do not modify.
/// </summary>
public void _Shutdown()
{
thisApplication = null;
thisWorkbook = null;
}

/// <summary>
/// Finds the control with the specified name in the active worksheet.
/// </summary>
/// <param name='name'>Name of the control to find.</param>
/// <returns>
/// Returns the specified control, or null if it is not found.
/// </returns>
object FindControl(string name )
{
return FindControl(name, (Excel.Worksheet)
ThisWorkbook.ActiveSheet);
}

/// <summary>
/// Returns the control with the specified name in the specified
worksheet.
/// </summary>
/// <param name='name'>Name of the control to find.</param>
/// <param name='sheet'>Worksheet object that contains the
control.</param>
/// <returns>
/// Returns the specified control, or null if it is not found.
/// </returns>
object FindControl(string name, Excel.Worksheet sheet )
{
Excel.OLEObject theObject;
try
{
theObject = (Excel.OLEObject) sheet.OLEObjects(name);
return theObject.Object;
}
catch
{
// Returns null if the control is not found.
}
return null;
}

#endregion
protected void ThisWorkbook_Open()
{
this.btn =(MSForms.CommandButton)this.FindControl("btn");
// Attaches the events after making sure the variables
// have been properly initialized.
if (this.btn != null )
{
this.btn.Click += new
MSForms.CommandButtonEvents_ClickEventHandler(btn_ Click);
}
//rng = (Excel.Range)ws.Cells[1,1];
//localhost.SQLQuery.Service1 ser = new localhost.SQLQuery.Service1();

}

private void btn_Click()
{
localhost.SQLQuery.Service1 ser = new localhost.SQLQuery.Service1();
rng = (Excel.Range)ws.Cells[1,1];
ser.DbEntry(rng);
//this.textboxShowText.Text += "Hello World! ";


}
protected void ThisWorkbook_BeforeClose(ref bool Cancel)
{
Cancel = false;
}
}
}

ERROR IN THIS EXCEL PROJECT IS::

1. C:\Documents and Settings\pmudl\My Documents\Visual Studio Projects\My
Excel Chart Options\ThisWorkbook.cs(43): The name 'Worksheet' does not exist
in the class or namespace 'My_Excel_Chart_Options.OfficeCodeBehind'

2. C:\Documents and Settings\pmud\My Documents\Visual Studio Projects\My
Excel Chart Options\ThisWorkbook.cs(142): The type or namespace name 'ser'
could not be found (are you missing a using directive or an assembly
reference?)

3. C:\Documents and Settings\pmud\My Documents\Visual Studio Projects\My
Excel Chart Options\ThisWorkbook.cs(140): The type or namespace name
'localhost' could not be found (are you missing a using directive or an
assembly reference?)

PLEASE HELP ME!

Thanks
"Ken Cox [Microsoft MVP]" wrote:
Your best bet would be to create a Web service with ASP.NET and have users
access it using Excel on their desktop.

How To Use an XML Web Service by Using ASP.NET from an Office VBA Macro in
Word or Excel

"This article demonstrates how to use an XML Web service using ASP.NET from
a Visual Basic for Applications (VBA) macro in Word or Excel. "

http://support.microsoft.com/default...b;en-us;307033

http://msdn.microsoft.com/library/de...l/odc_xlws.asp

http://www.codeproject.com/vb/net/Webservices.asp

Ken
Microsoft MVP [ASP.NET]
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud


Nov 19 '05 #11
Hi Ken,

I created a webservice which returns tha value form the cell[1] of teh
excel worksheet to the database.

"Ken Cox [Microsoft MVP]" wrote:
Your best bet would be to create a Web service with ASP.NET and have users
access it using Excel on their desktop.

How To Use an XML Web Service by Using ASP.NET from an Office VBA Macro in
Word or Excel

"This article demonstrates how to use an XML Web service using ASP.NET from
a Visual Basic for Applications (VBA) macro in Word or Excel. "

http://support.microsoft.com/default...b;en-us;307033

http://msdn.microsoft.com/library/de...l/odc_xlws.asp

http://www.codeproject.com/vb/net/Webservices.asp

Ken
Microsoft MVP [ASP.NET]
"pmud" <pm**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also,
Whatever
the USER ENETRS needs to go to the SQL DATABASE, probably by the click of
a
button.

Is this possible? & what is the BEST APPROACH for doing this? & also if
any
links are there do tell those to me too coz I have no idea how to go about
doing it.

Thanks
--
pmud


Nov 19 '05 #12
David Jessee wrote:
Guys, I would be very VERY careful about invoking any Microsoft Office
products from within ASP.NET

Microsoft even recomments that you stay away from it. You'll end up with a
few hundred rouge Excel.exe processes you can't kill


mmh... interesting - can you expand on that and possibly give a link?

Thanks and HNY!

--
Software is like sex: it's better when it's free -- [Linus Torvalds]

Fabio Marini - A+, RHCT, MCDBA, MCAD.NET
To reply: news [at] mamakin1976 [dot] plus [dot] com
Nov 19 '05 #13
Hi pmud,

I actually wrote an ASP.NET application for a client which uploaded an
*.xls file which was the customers MailList. I then parsed the data and
dumped it into the clients SQL Server. It also allowed them to save
there work and edit at a later date if the wanted to. You can view a
sample here:

http://members.shaw.ca/s-eisenberg/s...amples.htm#Tel

Happy Coding,

Stefan
C# GURU
www.DotNETovation.com

"You always have to look beyond the horizon and can never be complacent
-- God forbid we become complacent."

Jozef Straus

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #14
JC
Find your Office CD in it there is either OWC10.exe or OWC11.exe. These are
the setups for the Office Web Components. There is one of the objects called
a SpreadsheetClass component that can load only one kind of Excel spreadsheet
the .xml spreadsheet. This means that you can save any spreadsheet in xml
format and open it using OWC and use it as a regular spreadsheet without the
overhead of Excel on the web. You can use every formula available to Excel
meaning that you can use it as a calculation engine as well. You won't even
have to rewrite your application a lot because it uses the same object model.
Please look over the licensing restrictions to be sure it meets your needs.
You will find it very cool that you won't have 10 copies of Excel open at
the same time on your web server because your interop did not terminate them
correctly.

Here is a sample piece of a function using the spreadsheet in VB (I know you
don't like it sorry). I named the ranges to make it easier to read. The
documentation that is installed with the OWC will explain and have other
examples for you. It will free you from the complexities of using Excel as a
remote server.

Public Sub New(ByVal strSheetPath As String)
sp = New SpreadsheetClass
Try

'This is how we load it.
sp.XMLURL = strSheetPath
sp.Calculation = XlCalculation.xlCalculationAutomatic
Catch ex As Exception

RaiseEvent ErrorLoading(ex.Message)

End Try
End Sub

Public Function getSheetValues(ByVal intOption As Integer, ByVal lsalary
As Long, ByVal Excl As Boolean, ByVal intFlexall As Integer, ByVal intdeps As
Integer) As Benefit

Dim ob As Sheets
Dim o As Name
Dim ben As New Benefit
' i.Interval = 60

Try
If bGiveMeTime = True Then
sp.ActiveSheet.Range("benefitoptionid").Value = intOption
sp.ActiveSheet.Range("EXCLUDE").Value = Excl
sp.ActiveSheet.Range("salary").Value = lsalary
sp.ActiveSheet.Range("totaldependents").Value = intdeps
' sp.ActiveSheet.Range("benefitoptionid").Value()
bEvent = False

sp.CalculateFull()
ben.intFlex = CInt(sp.ActiveSheet.Range("flextotal").Value)
ben.dCont = CDec(sp.ActiveSheet.Range("contot").Value)

Let me know how it went.

Juan C. Marin MCP
jc*****@hewitt.com

"Stefan" wrote:
Hi pmud,

I actually wrote an ASP.NET application for a client which uploaded an
*.xls file which was the customers MailList. I then parsed the data and
dumped it into the clients SQL Server. It also allowed them to save
there work and edit at a later date if the wanted to. You can view a
sample here:

http://members.shaw.ca/s-eisenberg/s...amples.htm#Tel

Happy Coding,

Stefan
C# GURU
www.DotNETovation.com

"You always have to look beyond the horizon and can never be complacent
-- God forbid we become complacent."

Jozef Straus

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
Hi, everything works apart from the last line :-(( rng.Value2.ToString() An exception is thrown : "Old format or invalid type library" It gets compiled though (so he recognizes the property...
4
by: Lisa | last post by:
Hi - I'm able to open excel workbooks and word documents, but I can't seem to copy excel charts, named ranges, etc. to a word document. Anyone know of good reference material in this area? What...
3
by: | last post by:
Hello, I have a routine in my Windows application that exports the contents of a datagrid to Excel. It is modeled closely after the HowTo example on MSDN: http://tinyurl.com/5g2jm. Depending...
3
by: | last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It works perfectly on my machine, but it fails on my customers' PCs that have identical versions of Win XP (SP1) and Excel...
3
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to...
0
by: manoharcr | last post by:
I am using the fallowing code.... This condition generats a two different excel sheet based on IF condition If(Condtion) { response.setContentType("application/vnd.ms-excel");...
0
by: rajeshkothuru | last post by:
Hi I am new to perl programming, i stcked at one line. I have written code such that new excel sheet will save accordingly even though if already existed Excel sheet persists. The problem is if...
1
by: BLavanya | last post by:
I want to Open an excel sheet , then I want to loop through the rows in the excel sheet and should execute an update query for all the rows where the where condition in the query should match the...
6
by: poolboi | last post by:
hi all, i've got the following program that needs yr help: use Win32::OLE; # use existing instance if Excel is already running eval {$ex =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.