且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何打开使用上载上传的Excel文件...

更新时间:2023-10-17 12:03:16

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")