473,387 Members | 1,678 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,387 software developers and data experts.

excel sheet problem

115 100+
hi i had xls template in server and write some value show to the client browser. if i click save (file -> save) button . it is save in server but i need save in client location

here is my code

<----Code start here --->


SqlConnection db_con = new SqlConnection("Data Source=192.168.0.10;Initial Catalog=test; User Id=sa; Password=");
db_con.Open();

//Excel.Application objExl = new Excel.ApplicationClass();
Excel.Application objExl = new Excel.Application();
string excelfilepath = Server.MapPath(".")+"/ExcelReport/sampleReport.xls";


//Excel.Workbook ExlWrBk = objExl.Workbooks.Open(@"\\192.168.50.252\software\ _Common\manju" + @"\sampleReport.xls", 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Excel.Workbook ExlWrBk = objExl.Workbooks.Open(excelfilepath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Excel.Sheets ExlShts = ExlWrBk.Worksheets;

Excel.Worksheet objWrSht = (Excel.Worksheet)ExlShts.get_Item("sampleReport");

Excel.Range ExlRng = (Excel.Range)objWrSht.get_Range("A1", "A1");


SqlCommand cmd = new SqlCommand("select * from customermaster", db_con);

//SqlDataReader dr = null;
SqlDataReader dr5 = cmd.ExecuteReader();

DataSet ds = new DataSet();




int Row = 2;


while(dr5.Read())

{

objWrSht.Cells[Row, 1] = "1";

objWrSht.Cells[Row, 2] = dr5["cusname"];//ds.Tables[0].Columns["cusName"];

objWrSht.Cells[Row, 3] = dr5["cusCompnay"];

objWrSht.Cells[Row, 4] = dr5["cusindustry"];

objWrSht.Cells[Row, 5] = dr5["cusdesig"];

objWrSht.Cells[Row, 6] = dr5["cusaddress1"];

objWrSht.Cells[Row, 7] = dr5["cusaddress2"];

objWrSht.Cells[Row, 8] = dr5["cuscity"];

objWrSht.Cells[Row, 9] = dr5["cuspincode"];

objWrSht.Cells[Row, 10] = dr5["cusmobileno"];

objWrSht.Cells[Row, 11] = dr5["cusLandLineNo"];

objWrSht.Cells[Row, 12] = dr5["cusEmail"];

objWrSht.Cells[Row, 13] = dr5["cusintereston"];

objWrSht.Cells[Row, 14] = dr5["cusinterestlevel"];

objWrSht.Cells[Row, 15] = dr5["cusdatelastmet"];

objWrSht.Cells[Row, 16] = dr5["cusnextmeetingdate"];

objWrSht.Cells[Row, 17] = dr5["cusFollowupstatus"];


Row = Row + 1;

}
objExl.Visible = true;

<-----Code End here--->


pls response immd Asap

Thanks
Feb 21 '08 #1
1 1018
yogarajan
115 100+
hi All

i have one more doubt

my program is working fine in local. but it is not working in server

why?

pls response immd

Thanks

Yogarajan.G
Feb 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
2
by: Niyazi | last post by:
Hi, I have to retrieve a data from AS400 DB2 and after working with data I have to export into one of existing Excel file. I can connect into specific library in AS400 DB2 using AS400...
5
by: Rajiv | last post by:
HI ALL, actually , i m working in a company having large number of employee , i have two userid and password . on id is from admin group(id given to me by technology manager) of the server and...
12
by: elziko | last post by:
I'm using late binding (I must) to automate Excel. My code opens Excel after createing and poulating some sheets. My problem is that when the user finally decides to close Excel its process is...
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...
18
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a...
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...
13
by: chuckie_9497 | last post by:
hello all you gurus. I am struggling with releasing com objects. I have isolated the problem to the code below. Objects are released and the process ends until I use "int k = sheet.Count;" Then...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.