本文介绍了带vb编码的asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在类中给出编码

i give the coding in class

Public sub fill_combo(byval ddl as dropdownlist,byval field as string,byval condition s string)
dim dr as sqldatareader
dim a() as string
ddl.items.clear()
dim l as new listitem
l.text="select "
l.value=0
ddl.items.add(l)
dr=viewrecord_dr(field,tbl,condition)
if field.contains(",") then
a=field.split(",")
while dr.read
dim li as new listitem
li.value=dr.item(0)
li.text=dr.item(1)
ddl.items.add(li)
end while
else
while dr.read
ddl.items.add(dr.item(0))
end while
end if
dr.close()
end sub


我在课堂上给这个编码


I give this coding in class

Public function viewrecord_dr(byval field as string,byval condition s string)as sqldatareader
dim query as string 
query="select"
query=query+"from "+tbl
if condition.trim.length>0 
else
query=query
end if
cmd=new sqlcommand (query,con)
dr=cmd.excutereader()
viewrecord_dr=dr
end function


我在pageload中给出了此编码


i give this coding in pageload

c.connect()
call c.fill_combo(ddlservicenumber,"servicenumber","tblregistration","")
c.disconnect()


我的错误是无效的列名servicenumberfrom"
请清除此错误


My error is ''invalid column name servicenumberfrom"
please clear this error

推荐答案


Public sub viewrecord_dr(byval field as string,byval condition s string)
dim query as string
query = "select from " & tbl
if tbl = nothing then
exit sub
end if

cmd=new sqlcommand (query,con)
'Where is dr defined?
dr=cmd.excutereader()
'And why not: viewrecord_dr = cmd.excutereader()
viewrecord_dr=dr
end function



您的代码似乎需要很多工作....



Your code looks like it needs a lot of work though....


这篇关于带vb编码的asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:57