验证代码。?没有工作 [英] Code for validation.???Not working

查看:52
本文介绍了验证代码。?没有工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请通过代码,声明bolde d无效,

这是用于代码验证.......

代码:(vb)


str = ListView1.SelectedItem

rs1.Open" select * from empdetail Where name =''" &安培; str& "''",conn,adOpenStatic,adLockOptimistic

store = rs1!id
如果rs1.EOF那么

conn 。执行插入saldetail(id,date,othours,otamt,taxrate,netsal,pro vince)值(''"& store&"'',''"& dtpay&" '',''"& txtoh&"'',''"& txtotamt&"'',''"& txttr&"'',''"& ; txtnsal&"'',''"& cbostate&"'')"

MsgBox" INSERTED NEW RECORDS",vbOKOnly," ADDING NEW RECORDS"

否则

''在DB中找到的ID(重复)

MsgBox已经存在,vbExclamation,ERROR

结束如果

rs1.Close

设置rs1 =没什么


PLease go thru ...... ..谢谢提前

解决方案




不要使用Str ; 作为变量名



保留断点并检查变量是否由所选名称填充,或者您可能必须使用SelectedItem的SubItems ..


REgards

Veena


[B ] if 循环[/ b]不工作

代码:vb
如果不是rs1.eof那么

如果我们添加这个代码它也不会工作....

是的,没有相应的结果在

store = rs!ID


hELP ME ... 。谢谢aNAANCE


你能否比不工作更具体?这可能意味着从错误的方式分支到烧毁你的房子。 :)

Please go thru the code,the statement bolde d is not working,
this is for code validation.......
Code:(vb)

str = ListView1.SelectedItem
rs1.Open "select * from empdetail Where name=''" & str & "''", conn, adOpenStatic, adLockOptimistic
store = rs1!id
If rs1.EOF Then
conn.Execute "insert into saldetail(id,date,othours,otamt,taxrate,netsal,pro vince)values (''" & store & "'',''" & dtpay & "'',''" & txtoh & "'',''" & txtotamt & "'',''" & txttr & "'',''" & txtnsal & "'',''" & cbostate & "'')"
MsgBox "INSERTED NEW RECORDS", vbOKOnly, "ADDING NEW RECORDS"
Else
''ID Found In DB (Duplicate)
MsgBox "Already exists", vbExclamation, "ERROR"
End If
rs1.Close
Set rs1 = Nothing

PLease go thru........Thanks in advance

解决方案

Hi,

DONT USE "Str" as Variable name
and
Keep a Breakpoint and check if the variable is populated by the selected name, or you may have to use SubItems of the SelectedItem..

REgards
Veena


The[B] if loop [/b] is not working
code:vb
if not rs1.eof then
if we add this code too it wont work....
yes,a no corresoponding is comin in
store=rs!ID

hELP ME....thanks iN aDVANCE


Could you be more specific than "not working"? That could mean anything from branching the wrong way to burning down your house. :)


这篇关于验证代码。?没有工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆