| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1049 人关注过本帖
标题:幫心找一下錯誤!!!!
只看楼主 加入收藏
xunmi_love
Rank: 2
等 级:论坛游民
帖 子:204
专家分:18
注 册:2006-10-14
结帖率:57.14%
收藏
 问题点数:0 回复次数:4 
幫心找一下錯誤!!!!
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="big5" %>
<[email=%@Import]%@Import[/email] Namespace =Namespace="System.Data"%>
<[email=%@Import]%@Import[/email] Namespace="System.Data.OleDb"%>
<script runat="server">
Sub UploadFile(sender As Object, e As EventArgs)
    Dim FileExt
    FileExt = LCase(Right(Trim(FileUp.Value),3))
    If FileExt = "gif" Or FileExt = "jpg" Or FileExt = "bmp" Or FileExt = "png" Or FileExt = "tif" Or LCase(Right(Trim(FileUp.Value),4)) = "jpeg" Then
        If FileUp.PostedFile.ContentLength = 0 Then
        FileInfo.Visible = False
        Exit Sub
        Else
        FileInfo.Visible = True
        End If
        FSize.Text = CStr(FileUp.PostedFile.ContentLength)
        FName.Text = FileUp.PostedFile.FileName
        Dim FileSplit() As String = Split( FileUp.PostedFile.FileName, "/" )
        Dim FileName As String = FileSplit(FileSplit.Length-1)
        FileUp.PostedFile.SaveAs( Server.MapPath(".") & "/Upload/" & FileName )
        Dim objCommand As OleDbCommand
        Dim objConnection As OleDbConnection
        objConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("Upload.mdb"))
        objCommand = New OleDbCommand("Insert Into Upload (FilePath) Values ('Upload/"+FileName+"')" , objConnection)
        Dim Exts() As String = Split( FileName, "." )
        Dim Ext As String = LCase(Exts(Exts.Length-1))
        If Ext <> "jpg" And Ext <> "jpeg" And Ext <> "gif" And Ext <> "txt" And Ext <> "htm" And Ext <> "html" Then
        FDisplay.Visible = False
        Else
        FDisplay.Text = "<A Target='_blank' HREF='Upload/" & _
        FileName & "'>上传文件</A>"
        End If
        Response.Write("上传成功!")
    Else
'        Msgbox("对不起,只能上传扩展名为gif、jpg、bmp、png、tif或jpeg等图片文件!",65,"a")
        Response.Write("对不起,只能上传扩展名为gif、jpg、bmp、png、tif或jpeg等图片文件!")
    End If
End Sub
</script>
<Html>
<head>
<title>文件上传</title>
</head>
<Body BgColor=White>
<H3>上传文件<Hr></H3>
<Form Name="Form1" Enctype="multipart/form-data" runat="server">
上传文件
<Input Type="File" id="FileUp" runat="server"><P>
<Asp:button id="Upload" Text="Upload"
runat="server"/>
</form><Hr>
<Div id="FileInfo" Visible="False" runat="server">
上传文件名 <Asp:Label id="FName" runat="server"/><br>
上传文件大小 <Asp:Label id="FSize" runat="server"/><br>
<Asp:Label id="FDisplay" runat="server"/>
</Div>
</Body>
</Html>


編譯錯誤 描述: 資源編譯無法完成 (錯誤發生於服務要求)。請檢閱下列的特定錯誤詳細資料,並視情況修改您的原始程式碼。

編譯器錯誤訊息: BC30183: 關鍵字做為識別項無效。

原始程式錯誤:

[沒有相關的原始程式碼]

[font=Verdana]原始程式檔:
C:\WINDOWS\\Framework\v2.0.50727\Temporary Files\root\67a5b378\2db99554\App_Web_uploadfile.aspx.cdcab7d2.tauisay6.0.vb    行: 15 [/font]
搜索更多相关主题的帖子: FileExt Namespace Import Data System 
2008-06-26 17:44
tomtory
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:705
专家分:0
注 册:2008-6-12
收藏
得分:0 
晕晕 VB语言的 好像是
2008-06-26 17:49
贝蕾
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2008-6-26
收藏
得分:0 
看vb的代码头疼
2008-06-26 18:58
twtdd
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2008-6-12
收藏
得分:0 
用这个比较简单
<HTML>
    <HEAD>
        <Title>刘友生应用程序集--单文件上传</Title><Script Language="VB" Runat="Server">
Sub FileUpload(sender As Object, e As Eventargs)
If myFile.PostedFile.ContentLength = 0 Then
    Result.Text = "<Font Color='Red'>上传失败或指定的文件不存在。</Font><Hr>"
    FileInfo.Visible = False
Else
    Dim Route() As String = Split(myFile.PostedFile.FileName, "\")   
    Dim FileName As String = Route(Route.Length - 1)
    myFile.PostedFile.SaveAs(Server.MapPath(".") & "\TempFile\" & FileName)
    FileInfo.Visible = True
    Result.Text = "<Font Color='Red'><B>文件上传成功!</B></Font>"
    FName.Text = FileName
    FSize.Text = Math.Round(myFile.PostedFile.ContentLength / 1024, 2) & "KB"
    FType.Text = myFile.PostedFile.ContentType
End If
End Sub
        </Script>
    </HEAD>
    <Body BgColor="#fff2cc">
        <Center><H3><Font>文件上传</Font></H3>
        </Center>
        <Form Runat="Server" Enctype="multipart/form-data" ID="Form1">
            <Center>
                选择上传文件: <Input Type="file" Runat="Server" Id="myFile" Size="36" NAME="myFile"><Br>
                <Br>
                <Asp:Button Runat="Server" Text="上传文件" OnClick="FileUpload" ID="Button1" />
                <Input Type="reset" Value="重新设置">
                <Hr Size="1" Color="green">
                <Asp:Label Runat="Server" Id="Result" />
            </Center>
        </Form>
        <Asp:Panel Runat="Server" Id="FileInfo" Visible="False" Height="40px">
你的文件将上传在服务器当前文件夹下的TempFile夹下<BR>文件名称:
<Asp:Label id="FName" Runat="Server"></Asp:Label><BR>文件大小:
<Asp:Label id="FSize" Runat="Server"></Asp:Label><BR>文件类型:
<Asp:Label id="FType" Runat="Server"></Asp:Label><BR>
</Asp:Panel>
    </Body>
</HTML>
2008-06-27 14:54
雪雨星风
Rank: 1
来 自:北京
等 级:新手上路
威 望:1
帖 子:566
专家分:0
注 册:2007-10-11
收藏
得分:0 

C#发烧友QQ群1:5953354   QQ群2:68096127  QQ群3:30217249  QQ群4:37023079   为了更好方便大家交流学习,请不要重复加群
2008-06-27 17:59
快速回复:幫心找一下錯誤!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017915 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved