![]() |
【转帖】[求助]自编一个利用ado编程的例子,有个头疼的问题
[求助]自编一个利用ado编程的例子,有个头疼的问题
www.dimcax.com [求助]自编一个利用ado编程的例子,有个头疼的问题 private sub combobox1_click() dim cn as connection set cn = new connection cn.open "provider=microsoft.jet.oledb.3.51;data source=d:\cf.mdb;" dim cmd as new adodb.command set cmd.activeconnection = cn cmd.commandtext = "select b,h,name from cf1 where name='" & combobox1.text & "'" dim rst as new adodb.recordset rst.cursorlocation = aduseclient rst.open cmd, , adopenstatic, adlockbatchoptimistic do while not rst.eof userform1.textbox1.text = rst("h") userform1.textbox2.text = rst("b") rst.movenext loop rst.clone end sub private sub commandbutton1_click() userform1.hide dim pt as variant pt = thisdrawing.utility.getpoint(, "拾取插入点:") h = val(userform1.textbox1.text) b = val(userform1.textbox2.text) dim ax1(0 to 2) as double dim ax2(0 to 2) as double dim ax3(0 to 2) as double dim ax4(0 to 2) as double ax1(0) = pt(0) ax1(1) = pt(1) ax1(2) = pt(2) ax2(0) = pt(0) + b ax2(1) = pt(1) ax2(2) = pt(2) ax3(0) = pt(0) ax3(1) = pt(1) + h ax3(2) = pt(2) ax4(0) = pt(0) + b ax4(1) = pt(1) + h ax4(2) = pt(2) dim linea, lineb, linec, lined as acadline set linea = thisdrawing.modelspace.addline(ax1, ax2) set lineb = thisdrawing.modelspace.addline(ax2, ax3) set linec = thisdrawing.modelspace.addline(ax3, ax4) set lined = thisdrawing.modelspace.addline(ax4, ax1) end sub private sub userform_initialize() combobox1.additem "10*20" combobox1.additem "15*30" combobox1.additem "20*40" end sub 执行以后出现这句提示:实时错误‘-2147217904(80040阿0)’:至少一个参数没有被指定值。 因有窗口,再还有一个access数据库,将之压缩上传[upload=rar]uploadimages/ 你的数据库结构有问题 数据库的三个字段。字段名分别为“字段1”、“字段2”、“字段3”。而你想要的字段名应该是“name”、“h”、“b”,只是你把它们作为了表的第一条记录。修改的方法: 在access中打开数据库,右击表cf1,选择“设计”,把字段改过来就行了。当然,真正实用的数据库还应该设置字段的数据类型。 "select 字段1,字段2,字段3 from cf1 where name= 金版主这句sql大概不好吧 如果不愿改动数据库结构,sql语句应该这样写: select 字段1 as name,字段2 as h,字段3 as b where name=...... 昏!忙中出错。是我自己太粗心啦!谢谢各位! 三人行,必有我师也! |
所有的时间均为北京时间。 现在的时间是 11:53 PM. |