Advertisement
Advertisement
| 04.01.2008 at 09:44PM PDT, ID: 23288125 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: |
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
System.Threading.Thread.Sleep(5000)
Dim mybyte() As Byte
ReDim mybyte(0)
mybyte(0) = 34
Dim strTitle As String = txtTitle.Text
If (strTitle.IndexOf("\") > -1) Or (strTitle.IndexOf("/") > -1) Or (strTitle.IndexOf("<") > -1) Or _
(strTitle.IndexOf(">") > -1) Or (strTitle.IndexOf("*") > -1) Or (strTitle.IndexOf("|") > -1) Or _
(strTitle.IndexOf("?") > -1) Or (strTitle.IndexOf(":") > -1) Or (strTitle.IndexOf(ASCIIEncoding.ASCII.GetString(mybyte)) > -1) Then
lblTitleError.Text = "J,( 'F JCHF 'D9FH'F E*CHF EF '1B'E H -1HA AB7"
lblTitleError.Visible = True
lbldescriptionError.Visible = False
lblUploadError.Visible = False
ElseIf (txtTitle.Text = "") Then
lblTitleError.Text = "J,( 'F *69 9FH'F 'DC*'("
lblTitleError.Visible = True
lbldescriptionError.Visible = False
lblUploadError.Visible = False
ElseIf (txtDescription.Text = "") Then
lbldescriptionError.Visible = True
lblTitleError.Visible = False
lblUploadError.Visible = False
ElseIf Not (FileUpload1.HasFile) Then
lblUploadError.Text = "J,( 'F *.*'1 EDA 'DC*'("
lblUploadError.Visible = True
lbldescriptionError.Visible = False
lblTitleError.Visible = False
Else
lblUploadError.Visible = False
lbldescriptionError.Visible = False
lblTitleError.Visible = False
If (FileUpload1.HasFile = True) Then
Dim fileExt As String
fileExt = System.IO.Path.GetExtension(FileUpload1.FileName)
If (fileExt = ".zip") Then
Dim titleExists As Boolean = False
Using myconn As New OleDbConnection(ConfigurationManager.ConnectionStrings("MasterDataFile").ConnectionString)
myconn.Open()
Using command1 As New OleDbCommand("select title from Books where title = '" & txtTitle.Text & "'", myconn)
command1.CommandType = CommandType.Text
Dim myreader As OleDbDataReader
myreader = command1.ExecuteReader
If (myreader.HasRows) Then
titleExists = True
End If
End Using
If (titleExists = True) Then
lblTitleError.Text = "'D9FH'F 'D0J '.*1*G E*C11 AJ B'9/) 'D(J'F'*, '.*1 9FH'F '.1"
lblTitleError.Visible = True
Else
lblTitleError.Visible = False
btnSave.Enabled = False
Try
FileUpload1.SaveAs("D:\project(2-4-2008)\Data\Books\" & txtTitle.Text & ".zip")
lblUploadError.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
FileUpload1.PostedFile.ContentType
Dim fileName As String = "D:\project(2-4-2008)\Data\Books\" & txtTitle.Text & ".zip"
Using mycommand As New OleDbCommand("insert into Books(title, description, file_name) values('" & txtTitle.Text & "','" & txtDescription.Text & "','" & fileName & "')", myconn)
mycommand.CommandType = CommandType.Text
mycommand.ExecuteNonQuery()
End Using
Server.Transfer("AddNewBookSuccess.aspx", False)
Catch ex As Exception
lblUploadError.Text = "ERROR: " & ex.Message.ToString()
lblUploadError.Visible = True
End Try
End If
End Using
Else
lbldescriptionError.Visible = False
lblTitleError.Visible = False
lblUploadError.Text = "Only .zip files allowed!"
lblUploadError.Visible = True
End If
End If
End If
End Sub
-----------------------------------------------------------------
here is the html code:
---------------------------------------------------
<asp:Content ID="Content1" ContentPlaceHolderID="BooksChildPlaceHolder" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate >
<table width="100%">
<tr>
<td colspan = "2" align = "center">
<asp:Label ID="lblHeader" runat = "server" Font-Size="X-Large"
Font-Underline="True" >'6'A) C*'( ,/J/</asp:Label>
<br />
<br />
</td>
</tr>
<tr>
<td align="center">
<asp:Label id= "lblTitleError" runat = "server"
Text="J,( 'F JCHF 'D9FH'F E*CHF EF '1B'E H -1HA AB7" Visible = "False"
BackColor="Yellow" Font-Size="Large" Width="100%" ></asp:Label>
<br />
<asp:TextBox ID="txtTitle" runat = "server" MaxLength="255" Width="100%"
CssClass="TextStyle"></asp:TextBox>
<br />
</td>
<td align="center">
<asp:Label ID="label1" runat ="server" Font-Size="Large" >9FH'F 'DC*'(</asp:Label>
</td>
</tr>
<tr>
<td align="center">
<asp:Label id= "lbldescriptionError" runat = "server"
Text="J,( 'F *69 E.*51 DDC*'( B(D 9EDJ) 'D-A8" Visible = "False"
BackColor="Yellow" Font-Size="Large" Width="700px" ></asp:Label>
<br />
<asp:TextBox ID="txtDescription" runat = "server" MaxLength="255" Width="700px"
CssClass="TextStyle" Height="69px" TextMode="MultiLine" ></asp:TextBox>
</td>
<td align="center" >
<asp:Label id="label2" runat = "server" Font-Size="Large">E.*51 'DC*'(</asp:Label>
</td>
</tr>
<tr>
<td align="center" colspan = "2">
<asp:Label id= "lblUploadError" runat = "server" Visible = "False"
BackColor="Yellow" Font-Size="Large" Width="100%" ></asp:Label>
<br />
<asp:FileUpload ID="FileUpload1" runat="server" Font-Size="Large" EnableViewState = "true" />
</td>
</tr>
<tr>
<td align="center" colspan = "2">
<br />
<asp:Button ID="btnSave" runat="server" Font-Size="Large" Text="-A8 'DC*'(" />
<br />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table width = "100%">
<tr>
<td align = "center" >
<asp:UpdateProgress ID="UpdateProgress1" runat="server" >
<ProgressTemplate>
<br /><br />
<asp:Image ID="myimage" runat = "server" ImageUrl ="~/images/progress.gif"
Height="61px" Width="67px" />
<br />
<br />
<asp:Label ID="mylabel" runat = "server" Text="Processing Request.........."
Font-Size="X-Large"></asp:Label>
</ProgressTemplate>
</asp:UpdateProgress>
</td>
</tr>
</table>
</asp:Content>
|