" & checkdata & "
##利用Tablel來將檢核的資料放入,以確認是否正確 ######################################
Sub checkdata(ByVal FileRec As String)
Dim TabRow As TableRow
Dim TabCell As TableCell
Dim checkdata As String = ""
Dim strRec As String()
Dim numcells As Integer
Dim i As Integer
strRec = Split(FileRec, ",")
numcells = UBound(strRec)
'0課程代號,1課程名稱,2課程類別,3上課時數,4課程類別I,5課程類別II
If numcells 5 Then '欄位長度有改時,下面也要改哦
checkdata = checkdata & "資料長度錯誤"
Else
If Len(strRec(0)) = 0 Or strRec(1) = "" Then
If checkdata "" Then
checkdata += ""
End If
checkdata += "課程代號不可為空白"
End If
If checkdata = "" Then
If CheckCourseID(strRec(0)) 0 Then
If checkdata "" Then
checkdata += ""
End If
checkdata += "資料重覆"
Else
If Len(strRec(4)) 0 Or strRec(4) "" Then
strRec(4) = CheckClassKind(strRec(4))
If strRec(4) = "" Then
If checkdata "" Then
checkdata += ""
End If
checkdata += "課程類別I資料錯誤"
End If
End If
If Len(strRec(5)) 0 Or strRec(5) "" Then
strRec(5) = CheckClassKind(strRec(5))
If strRec(5) = "" Then
If checkdata "" Then
checkdata += ""
End If
checkdata += "課程類別II資料錯誤"
End If
End If
End If
End If
End If
TabRow = New TableRow()
TabCell = New TableCell()
If checkdata = "" Then
TabCell.Text = "
Else
TabCell.Text = "
End If
TabRow.Cells.Add(TabCell)
For i = 0 To numcells
TabCell = New TableCell()
If strRec(i) = "" Then
TabCell.Text = " "
Else
TabCell.Text = strRec(i)
End If
TabRow.Cells.Add(TabCell)
Next i
'欄位長度有改時,這裡也要改哦,不然秀出來的資料若少一欄,會怪怪的
For i = numcells + 1 To 5
TabCell = New TableCell()
TabCell.Text = " "
TabRow.Cells.Add(TabCell)
Next i
TabCell = New TableCell()
If checkdata = "" Then
TabCell.Text = " "
Else
checkdata = "
TabCell.Text = checkdata
ErrorFlag = "Y"
End If
TabRow.Cells.Add(TabCell)
TbFileRec.Rows.Add(TabRow)
End Sub
- Nov 27 Tue 2007 14:59
【ASP.NET 2.0】提供User上傳檔案,更新資料II
close
全站熱搜
留言列表
發表留言