如何打开使用上载上传的Excel文件... [英] how to open an excel file which is uploaded using upload...

查看:119
本文介绍了如何打开使用上载上传的Excel文件...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道...然后回答这个问题,
我正在上传.xls文件.但我想检查文件是否正在上传,包括产品名称和价格(此r 2标头),那么只有它应该上传.否则它不应该...任何人都可以使用vb.net发送代码.这就是我如何上传.xls文件...现在添加下一个代码如何2检查?

请回复
感谢在广告中.
使用vb.net发送下一个零件代码


受保护的子UploadBtn_Click(ByVal发送者作为对象,ByVal e作为System.EventArgs)如果(FileUpLoad1.HasFile和FileUpLoad2.HasFile)然后
FileUpLoad1.SaveAs("C:\ Documents and Settings \ Administrator \ My Documents \ anil \" + FileUpLoad1.FileName)Label1.Text =上传的文件:"; + FileUpLoad1.FileName FileUpLoad2.SaveAs("C:\ Documents and Settings \ Administrator \ My Documents \ anil \"; + FileUpLoad2.FileName)Label2.Text =上传的文件:" + FileUpLoad2.FileName其他Label1.Text =否文件已上传."
Label2.Text =没有上传文件."
如果结束,则结束Sub

u know... then answer this,
im uploading .xls file. but i want to check whether the file im uploading consist productname and price(this r 2 header), then only it should upload. otherwise it shouldnot....can anybody send the code using vb.net. this how im uploading .xls file... now add next code how 2 check?

please reply
thanks in adv.
send the next part code using vb.net


Protected Sub UploadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If (FileUpLoad1.HasFile And FileUpLoad2.HasFile) Then
FileUpLoad1.SaveAs("C:\Documents and Settings\Administrator\My Documents\anil\" + FileUpLoad1.FileName) Label1.Text = "File Uploaded: "; + FileUpLoad1.FileName FileUpLoad2.SaveAs("C:\Documents and Settings\Administrator\My Documents\anil\"; + FileUpLoad2.FileName) Label2.Text = "File Uploaded:" + FileUpLoad2.FileName Else Label1.Text = "No File Uploaded."
Label2.Text = " No File Uploaded."
End If End Sub

推荐答案

anilsarda777写道:
anilsarda777 wrote:

但我想检查是否正在上传的文件包含产品名称和价格(此r 2标头),则只能上传.

but i want to check whether the file im uploading consist productname and price(this r 2 header), then only it should upload.



无法完成如何在不先上传的情况下检查文件的内容?

您的代码将在上传后运行,这样就可以了.我想我已经阅读过此代码和问题,您是否拥有多个帐户?

此处 [ ^ ]是有关如何在VB.NET中读取Excel工作表的大量信息.注意我是怎么得到的?



Can''t be done. how do you check the contents of a file without uploading it first ?

Your code will run after it''s uploaded, so that is OK. I think I''ve read this code and question before, do you have more than one account ?

Here[^] is a ton of info on how to read an Excel sheet in VB.NET. Notice how I got it ?


///在条件下使用select



cmd2.CommandText =选择*进入[MS Access; Database ="&Acces&].[表1]来自[Sheet1
///use select with condition



cmd2.CommandText = "SELECT * INTO [MS Access;Database=" & Acces & "].[Table1] FROM [Sheet1


Where ProductName =产品名称和价格=价格"

cmd2.ExecuteNonQuery()


//如果条件为true,则只有在条件不成立时才会产生错误.用于此用途:出错时转到

下一步:
MsgBox(错误的信息")
Response.Write("UPLOAD.1包含错误的EXCEL格式")
Where ProductName = Productname and price = price"

cmd2.ExecuteNonQuery()


//if condition is true then only it will take if not it will generate error. for that use: on error goto

nextstep:
MsgBox(" wrong informat")
Response.Write("UPLOAD.1 CONTAINS WRONG EXCEL FORMAT")


这篇关于如何打开使用上载上传的Excel文件...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆