查看: 1150|回复: 0
|
ASP 连接MY SQL的问题!
[复制链接]
|
|
我用ASP做了UPLOAD EXCEL(。CSV)的FUNCTION
当我UPLOAD 了CSV的FILE 后发现DELETE了MY SQL里的DATA后却不能
INSERT DATA 进去TABLE里!
我不知道是LINK MYSQL 的问题还是INSERT的问题!
这是我的CODING
qryDelete = "DELETE FROM xiamen_quoting_team"
Set rsDelete = conn.Execute(qryDelete)
Const Forreading = 1
Set objFSO = CreateObject("Scripting.fileSystemObject")
'Check the file exists
If objFSO.fileExists( Server.MapPath("Files/" & FileName) ) Then
Set oinStream = objFSO.OpenTextfile( Server.MapPath("Files/" & FileName), Forreading, False )
Call SetDefault()
sLine = oinStream.ReadLine
sLine = Replace(sLine, "'", ";")
sSeg = Split( sLine, "," )
cCount = countCommas(sLine)
For a = 0 to cCount
If sSeg(a) = "No" Then
No = a
ElseIf sSeg(a) = "Name" Then
Name = a
ElseIf sSeg(a) = "Email" Then
Email = a
ElseIf sSeg(a) = "DirectLine" Then
DirectLine = a
End If
Next
'Check if required fields exist...
If No = 45 OR Name = 45 OR Email = 45 OR DirectLine = 45 Then
Response.Redirect("UpdateLineCard.asp?res=Fields")
End If
'---------------------------------------
Do Until oinStream.AtEndOfStream
sLine = oinStream.ReadLine
sLine = Replace(sLine, "'", ";")
If countCommas(sLine) <> cCount Then
For c = 1 to (cCount - countCommas(sLine))
sLine = sLine & ","
Next
End If
sSeg = Split( sLine, "," )
qryInsert = "INSERT INTO xiamen_quoting_team (No, Name, Email, DirectLine)VALUES ('" &sSeg(No)& "', '" &sSeg(Name)& "', '" &sSeg(Email)& "', '" &sSeg(DirectLine)& "')"
Set rsInsert = conn.Execute(qryInsert)
Loop
oinStream.Close
Set oinStream = Nothing |
|
|
|
|
|
|
| |
本周最热论坛帖子
|