您的位置:程序门 -> vb -> 控件



text1.text为access表中的自动编号类型,但是运行时显示类型不符


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


text1.text为access表中的自动编号类型,但是运行时显示类型不符
发表于:2007-03-30 03:02:22 楼主
private   sub   command2_click()
set   con   =   new   adodb.connection
con.connectionstring   =   "provider=microsoft.jet.oledb.4.0;data   source=c:\swdata.mdb;persist   security   info=false "
con.cursorlocation   =   aduseclient
con.open
     
rst.open   "select   *   from   usermgmt   where   usermgmt!id=   ' "   &   clng(text1.text)   &   " ' ",   con,   adopenkeyset,   adlockoptimistic
  if   rst.bof   =   true   or   rst.eof   then
        msgbox   "您输入的用户不存在! ",   48,   "警告 "
else:
  rst.delete
  unload   me
  end   if
end   sub

id在access为自动编号类型
为什么与clng(text1.text)类型不符?
发表于:2007-03-30 07:40:521楼 得分:0
试试cint
发表于:2007-03-30 08:09:332楼 得分:0
rst.open   "select   *   from   usermgmt   where   usermgmt!id= ' "   &   text1.text   &   " ' ",   con
发表于:2007-03-30 12:41:383楼 得分:0
我在目的是调出数据库中id为text1.text中所显示数字的一条记录,然后删除

调不出来,总显示数据类型不符。
发表于:2007-03-30 12:43:144楼 得分:0
sorry,   it 's   a   vb   question.
发表于:2007-03-30 23:42:225楼 得分:0
换成

     
val(text1.text)或   text1.text   显示至少一个参数未指定

那位高手帮帮
发表于:2007-04-09 10:38:166楼 得分:0
不要用     ' "&   text1.text   & " '   ,試試用   "&   text1.text   & "     ,我最近遇到過,這樣就解決了。
发表于:2007-04-09 10:43:337楼 得分:0
rst.open   "select   *   from   usermgmt   where   usermgmt.id=   "   &   text1.text   &   " ",   con,   adopenkeyset,   adlockoptimistic

'usermgmt!id   -->   usermgmt.id
发表于:2007-04-09 10:46:398楼 得分:0
temp   =   val(delete1.text)
      delete0.open   "delete   from   salerecord   where   uid= "   &   temp   &   " ",   con,   adopendynamic,   adlockoptimistic
发表于:2007-04-09 10:56:499楼 得分:0
if   id=1
usermgmt.id=   "   &   text1.text   &   "     --------->     usermgmt.id=1       right
usermgmt.id=   ' "   &   text1.text   &   " '     --------->     usermgmt.id= '1 '   wrong
do   you   know?



快速检索

最新资讯
热门点击