将数据库记录保存到excel文件中,弹出消息

问题描述:

我的代码如下将数据库记录保存到excel中,如下所示;



xlWorkBook.SaveAs(@C:\ CourseWiseReport.xls ,Excel.XlFileFormat.xlWorkbookNormal,misValue,misValue,misValue,misValue,Excel.XlSaveAsAccessMode.xlExclusive,misValue,misValue,misValue,misValue,misValue);





当我保存excel时,在保存excel文件消息之前显示



一个名为''C:\courseWiseReprot.xls''的文件已经存在于这个loaction中。你要替换它吗?

是否取消。



当我保存excel时,当我点击按钮我想显示如下消息



Excel文件已创建。



i想显示以上内容仅限消息。

i不想要

一个名为''C:\courseWiseReprot.xls'的文件已存在于此loaction中。你要替换它吗?

是否取消。

上一条消息。



我该怎么办?



帮助我。

my code as follows saving the database records in to excel for that code as follows;

xlWorkBook.SaveAs(@"C:\CourseWiseReport.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);


when i save the excel,before saving the excel file message shows

A file named ''C:\courseWiseReprot.xls'' already exists in this loaction.Do you want to replace it?
Yes No Cancel.

when i save the excel,when i click the button i want to show the message as follows

Excel File Created.

i want to show the above message only.
i do not want
A file named ''C:\courseWiseReprot.xls'' already exists in this loaction.Do you want to replace it?
Yes No Cancel.
the previous message.

how can i do?

help me.

在执行SaveAs操作之前将WorkBook.Saved属性设置为true以避免提示对话框

WorkBoo.Saved [ ^ ]
set the WorkBook.Saved property to true before you perform the SaveAs operation to avoid the prompt dialog box
WorkBoo.Saved[^]


请参阅此示例 [ ^ ]和解决方案#1也适合您的查询......
See this example[^] and Solution #1 is also right for your query...