小问题需要大家的帮助!

fz8878 2005-05-03 09:29:28
以下是我写的一段代吗!不知那里错了,提交不到数据库!

Private Sub ok_Click()



On Error GoTo ErrHandler

If id.Text <> "" Then
txtSQL = "insert into [ywll] (id,quyu,xiaoqu,address,newadd,card,name,job,"
txtSQL = txtSQL & "xueli,mobil,tel,email,dddate,azday,rhday,hei1,clman,clweigui,"
txtSQL = txtSQL & "other1,cc1,ch1,w1,dw1,s1,d1,j1,cc2,ch2,w2,dw2,s2,d2,"
txtSQL = txtSQL & "j2,cc3,ch3,w3,dw3,s3,d3,j3,cc4,ch4,w4,dw4,s4,d4,j4,cc5,ch5,"
txtSQL = txtSQL & "w5,dw5,s5,d5,j6,cc6,ch6,w6,dw6,s6,d6,j6,cc7,ch7,w7,dw7,s7,d7,"
txtSQL = txtSQL & "j7,cc8,ch8,w8,dw8,s8,d8,j8,zhekou,ywje,heji,yufu,shiji,sunyi,"
txtSQL = txtSQL & "manyi,wgman,weigui,dengji,heiman,zxco,tsman,tousu,other2) "
txtSQL = txtSQL & " values (" & id.Text & "," & quyu.Text & "," & xiaoqu.Text & "," & address.Text & "," & newadd.Value & "," & card.Text & "," & name1.Text & "," & job.Text & "," & xueli.Text & "," & mobil.Text & "," & tel.Text & "," & email.Text & "," & dddate.Text & "," & azday.Text & "," & rhday.Text & "," & hei1.Text & "," & clman.Text & "," & clweigui.Text & "," & other1.Text & "," & cc1.Text & "," & ch1.Text & "," & w1.Text & "," & dw1.Text & "," & s1.Text & "," & d1.Text & "," & j1.Text & "," & cc2.Text & "," & ch2.Text & "," & w2.Text & "," & dw2.Text & "," & s2.Text & "," & d2.Text & "," & j2.Text & "," & cc3.Text & "," & ch3.Text & "," & w3.Text & "," & dw3.Text & "," & s3.Text & "," & d3.Text & "," & j3.Text & "," & cc4.Text & "," & ch4.Text & "," & w4.Text & "," & dw4.Text & "," & s4.Text & "," & d4.Text & "," & j4.Text & ","
txtSQL = txtSQL & "" & cc5.Text & "," & ch5.Text & "," & w5.Text & "," & dw5.Text & "," & s5.Text & "," & d5.Text & "," & j5.Text & "," & cc6.Text & "," & ch6.Text & "," & w6.Text & "," & dw6.Text & "," & s6.Text & "," & d6.Text & "," & j6.Text & "," & cc7.Text & "," & ch7.Text & "," & w7.Text & "," & dw7.Text & "," & s7.Text & "," & d7.Text & "," & j7.Text & "," & cc8.Text & "," & ch8.Text & "," & w8.Text & "," & dw8.Text & "," & s8.Text & "," & d8.Text & "," & j8.Text & "," & z.Text & "," & f.Text & "," & j0.Text & "," & yufu.Text & "," & shiji.Text & "," & sunyi.Text & "," & manyi.Text & "," & wgman.Text & "," & weigui.Text & "," & dengji.Text & "," & heiman.Text & "," & zxco.Value & "," & tsman.Text & "," & tousu.Text & "," & other2.Text & ")"

' txtSQL = txtSQL & "' where id='" & Trim(number.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
success = True
If MsgText = "insert query successful" Then
' MsgBox txtSQL, , "恭喜!"
MsgBox "录入成功!", , "恭喜!"
Else
MsgBox txtSQL, , "错误"
End If
Else
MsgBox "请填入单号!", , "错误"
End If

Exit Sub

ErrHandler:

MsgBox txtSQL
' MsgBox "数据库连接失败,请修复后重试!", , "失败!"

End Sub


请大家帮帮我,检查一下是哪里错了!谢谢~~
...全文
63 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fz8878 2005-05-07
  • 打赏
  • 举报
回复
恩,已经解决了。谢谢~!
sektor 2005-05-04
  • 打赏
  • 举报
回复
随手copy你的一段竟然是XXX.value...FT~~~~~

你的问题极可能是字符串型没有加''
日期型没加##
sektor 2005-05-04
  • 打赏
  • 举报
回复
不是很能猜出你的库字段类型,如果全是数据型的好像错也就错在你字段名,txt控件名写错了.

假如不是的话,试着在字符型字段的值前后加上''

比如:
...........& ",'" & zxco.Value & "'," & .............
饮水需思源 2005-05-03
  • 打赏
  • 举报
回复
将此插入语句先在SQL的查询分析器中执行试试,查询分析器会报告具体错误

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧