佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1150|回复: 0

ASP 连接MY SQL的问题!

[复制链接]
发表于 18-9-2007 08:16 AM | 显示全部楼层 |阅读模式
我用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
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT


本周最热论坛帖子本周最热论坛帖子

ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 30-9-2025 03:17 PM , Processed in 0.426588 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表