<script language="vb" runat="server"> Dim lngId as long
sub page_load(sender as object,e as eventargs)
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & server.MapPath(".") & "\tgTimeSheet.mdb"
myConn = New OledbConnection(strConn)
if not ispostback then
DataGrid1.Columns(1).Visible=true
dataGrid1.EditItemIndex =-1
GetdataSource()
end if
end sub Sub MyDataGrid_Edit(sender As Object, e As DataGridCommandEventArgs) lngId=5 End Sub
sub btDel_Click(sender as object,e as eventargs)
dim strsql as string
strsql ="delete ProjectCode where ID=" & lngId
response.write(strsql)
if lngId=0 then
response.write("删除不成功!<Br>请选择所删除的项目!")
exit sub
end if
' ExecuteSQL(strsql)
end sub
</script>
奇怪的是,我的公有变量lngId 无论我怎样做lngId 还是为0
sub page_load(sender as object,e as eventargs)
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & server.MapPath(".") & "\tgTimeSheet.mdb"
myConn = New OledbConnection(strConn)
if not ispostback then
DataGrid1.Columns(1).Visible=true
dataGrid1.EditItemIndex =-1
GetdataSource()
end if
end sub Sub MyDataGrid_Edit(sender As Object, e As DataGridCommandEventArgs) lngId=5 End Sub
sub btDel_Click(sender as object,e as eventargs)
dim strsql as string
strsql ="delete ProjectCode where ID=" & lngId
response.write(strsql)
if lngId=0 then
response.write("删除不成功!<Br>请选择所删除的项目!")
exit sub
end if
' ExecuteSQL(strsql)
end sub
</script>
奇怪的是,我的公有变量lngId 无论我怎样做lngId 还是为0
解决方案 »
- 球衣方法删选重复数据
- 问个jquery 简单的问题
- frameset问题
- vs不能设断点调试应该怎么设置?
- Repeater 如何绑定一个string[]?
- 读取xml问题
- 为什么在vs2005中使用foreach会出现“Collection was modified; enumeration operation may not execute”错误?
- 试着做一个电子商务类的网站大家给点思路?
- 我想知道。NET的技术到了什么地步就可以学设计模式了
- 还是web打印问题,如果有同样问题的,一起研究!
- 高分求解:关于IE自动产生的提示框,怎么控制,120分相送,不够可另加!!
- DataGrid绑定变量问题,请大侠解决
我试过把dim lngID as long
改为public lngid as long ,和private lngid as long
但还是不行,这是什么原因啊,大家帮下我啊,,HELP ME!!!~~~
就是传到btDel_Click时就又变回0了,,
郁闷....
script language="vb" runat="server"> Dim lngId as long
sub page_load(sender as object,e as eventargs)
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & server.MapPath(".") & "\tgTimeSheet.mdb"
myConn = New OledbConnection(strConn)
if not ispostback then
DataGrid1.Columns(1).Visible=true
dataGrid1.EditItemIndex =-1
GetdataSource()
end if
end sub Sub MyDataGrid_Edit(sender As Object, e As DataGridCommandEventArgs) lngId=5 End Sub
sub btDel_Click(sender as object,e as eventargs)
dim strsql as string
strsql ="delete ProjectCode where ID=" & lngId
response.write(strsql)
if lngId=0 then
response.write("删除不成功!<Br>请选择所删除的项目!")
exit sub
end if
' ExecuteSQL(strsql)
end sub
</script>
奇怪的是,我的公有变量lngId 无论我怎样做lngId 还是为0
==========================================
这样它怎么都不会为0了!结贴给分吧