为什么会无法写入Access? 本帖最后由 bcrun 于 2011-01-28 20:20:13 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Private Sub command1_click() Label4.Caption = "网站名称: " & Text2.Text Label5.Caption = "分类: " & Combo1.Text Label6.Caption = Combo2.Text Adodc1.RecordSource = "select * from 总表 where 网址 = '" & Text1.Text & "' " Adodc1.Refresh If Adodc1.Recordset.RecordCount > 0 Then Text2.Text = "" MsgBox "存在" Label7.Caption = "" Else conn.Execute "insert into 生活服务 (分类,网址,名称,备注1,备注2,备注3,备注4) values ( '" & Combo2.Text & "', '" & Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "') " conn.Execute "insert into 总表 (分类,网址,名称,备注1,备注2,备注3,备注4) values ( '" & Combo2.Text & "', '" & Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "') " Label7.Caption = "信息写入成功" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" End IfEnd Sub 去掉了好多空格,lz不应该的空格太多了Adodc1.Recordset.Update 这句没用 lz的conn引用了吗?定义了吗? conn.execute "insert into 表名(字符型字段,数值型字段) values('"& 字符型变量 &"',"& 数值型变量 &")" 数据可能已经写入,ADODC和ADODB混用时,ADODC要延时重新查询。如果是conn..Execute...无法写入数据库,会有报错指明原因,按错误原因修改也就是了。建议不要ADODC与ADODB混用,只要其中一个就能完成所有任务。 Adodc1.RecordSource = "select * from 总表 where 网址 = '" & Text1.Text & "' "这句还是提示事实错误:“424”要求对象 你窗体上没有Adodc1或Text1引起的 Picture1的问题 新手做控件ActiveX,再提一问怎么使控件全屏。 listview与mshflexgrid两个控件,哪一个系统资源占用少些呀? 关于程序打包的问题,各位推荐一下有什么好工具 杭州创业软件公司的卑鄙 从VB6转VB.NET需要看什么书,请大侠们给指点一下。 vb 如何获取网上邻居目录及计算机名和ip地址? ODBC数据源怎么设置 textBOX的对齐属性 运行时,会在executeNonQuery 出现未处理OleDbException,字符串错误,这应该怎么解决 哈哈哈哈,哥领到年终奖了,比金钱还震撼的东西,上图! 数据结构发生变化!!!!!!!
Label4.Caption = "网站名称: " & Text2.Text
Label5.Caption = "分类: " & Combo1.Text
Label6.Caption = Combo2.Text
Adodc1.RecordSource = "select * from 总表 where 网址 = '" & Text1.Text & "' "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text2.Text = ""
MsgBox "存在"
Label7.Caption = ""
Else
conn.Execute "insert into 生活服务 (分类,网址,名称,备注1,备注2,备注3,备注4) values ( '" & Combo2.Text & "', '" & Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "') "
conn.Execute "insert into 总表 (分类,网址,名称,备注1,备注2,备注3,备注4) values ( '" & Combo2.Text & "', '" & Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "') "
Label7.Caption = "信息写入成功"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End If
End Sub
要求对象