Diễn Đàn Tin Học

Hiển thị kết quả từ 1 đến 3 / 3

Chủ đề: cap cuu, cap cuu

  1. #1
    Tham gia
    16-07-2002
    Location
    Ha Noi
    Bài viết
    1,281
    Like
    0
    Thanked 0 Times in 0 Posts

    cap cuu, cap cuu

    Đoạn code sau đây không thể chạy được vì nhận lỗi
    Error Type:
    Microsoft VBScript runtime (0x800A0005)
    Invalid procedure call or argument
    /vbasp/uploader.asp, line 80 <-- dòng 80 tương ứng với dòng file.Write chr(ascb(midb(temp,tpoint,1)))

    Nhưng chỉ cần thay tpoint trong chr(ascb(midb(temp,tpoint,1))) bằng một giá trị số (thậm chí là dùng một biến khác và thiết lập cố định giá trị đó trước) trong khoảng 1 –> LenB (temp) thì nó lại chạy bình thường.
    Vậy lỗi trên ở đâu ra??????


    Public Function saveToFile(name, path)
    Dim tPoint
    If dict.Exists(name) Then
    Dim temp
    temp = dict(name).Item("Value")
    Dim fso
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    Dim file
    Set file = fso.CreateTextFile(path)
    For tPoint = 1 to LenB(temp)
    file.Write chr(ascb(midb(temp,tpoint,1)))
    Next
    file.Close
    saveToFile = True
    Else
    saveToFile = False
    End If
    End Function
    Quote Quote

  2. #2
    Tham gia
    06-08-2002
    Location
    Saigon
    Bài viết
    42
    Like
    0
    Thanked 0 Times in 0 Posts
    Có lẽ lỗi là ở chổ:

    temp = dict(name).Item("Value")

    Hãy xem lại giá trị của temp lúc đó.
    Bạn đã kiểm tra:......If dict.Exists(name) Then ...
    Nhưng sau đó lại là:.........temp = dict(name).Item("Value") .......

    Cấu trúc dictionary object của bạn ra sao?
    Hãy trình bày lại phần đó.

  3. #3
    Tham gia
    16-07-2002
    Location
    Ha Noi
    Bài viết
    1,281
    Like
    0
    Thanked 0 Times in 0 Posts
    hi!
    mình tìm ra lỗi rồi. Tại thiết lập Codepage nên nó mới bị vậy. Sau khi remove đi thì bình thường

Bookmarks

Quy định

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •