本文介绍了喜欢运算符不能在asp.net vb项目中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tbl_extension

tbl_extension

<table border="1" width="80%><br" mode="hold" />  <tr>
    <td>ID</td>
    <td>extension</td>
    <td>Class</td>
  </tr>
  <tr>
    <td>1</td>
    <td>.jpg</td>
    <td>image</td>
  </tr>
  <tr>
    <td>2</td>
    <td>.png</td>
    <td>image</td>
  </tr>
  <tr>
    <td>3</td>
    <td>.gif</td>
    <td>image</td>
  </tr>
  <tr>
    <td>4</td>
    <td>.bmp</td>
    <td>image</td>
  </tr>
  <tr>
    <td>5</td>
    <td>.avi</td>
    <td>video</td>
  </tr>
  <tr>
    <td>6</td>
    <td>.mp4</td>
    <td>video</td>
  </tr>
  <tr>
    <td>7</td>
    <td>.mp3</td>
    <td>audio</td>
  </tr>
  <tr>
    <td>8</td>
    <td>.wma</td>
    <td>audio</td>
  </tr>
</table>







DropDownList:




DropDownList:

<asp:DropDownList ID="DropDownList1" runat="server">
     <asp:ListItem>image</asp:ListItem>
     <asp:ListItem>video</asp:ListItem>
     <asp:ListItem>audio</asp:ListItem>
</asp:DrpDownList>





文件上传:



file upload :

<asp:FileUpload ID="FileUpload1" runat="server" />





上传按钮:



Upload Button :

<asp:Button ID="Button1" runat="server" Text="Upload" />









通知:我还使用vb类页面创建了与DataBase的连接。



我上传了一张图片(1.jpg),但此代码无效...





notice:I also created a connection to DataBase with a vb class page.

I uploaded an image(1.jpg) but this code isn't working...

con.connecton()

con.query("select * from tbl_extension where Class='" & DropDownList1.SelectedItem.ToString & "' ")

While con.Reader.Read()
If FileUpload1.FileName Like "*" & con.Reader("extension").toString then

     FileUpload1.PostedFile.SaveAs("c:\test\")




     EndIf

End While

con.Reader.Close()













通知:在这个例子中,我选择相同的图像,但它正在维持正常!!!!









notice:in this example i select the same image but it is woking normaly !!!.

If FileUpload1.FileName Like "*.jpg" then

          FileUpload1.PostedFile.SaveAs("c:\test\")

EndIf

推荐答案




这篇关于喜欢运算符不能在asp.net vb项目中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:52