C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着
For Each dgi As DataGridItem In Datagrid1.Items If (CType(dgi.FindControl("cbcb"), CheckBox).Checked) Then Dim i As Integer = IIf(CType(dgi.FindControl("cbsel"), CheckBox).Checked.ToString().ToLower() = "true", 1, 0) Dim j As Integer = IIf(CType(dgi.FindControl("cbadd"), CheckBox).Checked.ToString().ToLower() = "true", 1, 0) Dim k As Integer = IIf(CType(dgi.FindControl("cbupd"), CheckBox).Checked.ToString().ToLower() = "true", 1, 0) Dim l As Integer = IIf(CType(dgi.FindControl("cbdel"), CheckBox).Checked.ToString().ToLower() = "true", 1, 0) Response.Write(Convert.ToString(Datagrid1.DataKeys(dgi.ItemIndex)) & "
") Dim sql As String = String.Format("update powers set sels={0},adds={1},upds={2},dels={3} where id='{4}'", i.ToString(), j.ToString(), k.ToString(), l.ToString(), Convert.ToString(Datagrid1.DataKeys(dgi.ItemIndex))) db.GetState(sql) End If Imports System.Text Public Class PowersCheck Inherits System.Web.UI.Page Public Enum opertor adds upds dels sels End Enum Public Shared Sub Checks(ByVal userid As String, ByVal parts As String, ByVal oprator As Integer) Dim db As DbAccess = New DbAccess Dim sql As StringBuilder = New StringBuilder sql.Append("select") Dim edit As String = String.Empty If oprator = 0 Then edit = " adds" ElseIf oprator = 1 Then edit = " upds" ElseIf oprator = 2 Then edit = " dels" ElseIf oprator = 3 Then edit = " sels" Else edit = " sels" End If sql.Append(edit) sql.AppendFormat(" from powers where userid='{0}' and partid='{1}'", userid, parts) Dim sqltemp As String = sql.ToString() Dim succ As String = db.GetOne(sqltemp) If succ.ToLower() = "true" Then Else HttpContext.Current.Response.Write("") HttpContext.Current.Server.Transfer(HttpContext.Current.Request.Url.ToString() & "/login.aspx") End If End Sub End Class  
posted on 2008-06-12 00:23  王德田  阅读(776)  评论(0编辑  收藏  举报