VB update
来源:互联网 发布:培训java费用 编辑:程序博客网 时间:2024/05/29 04:05
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.OleDb
Public Partial Class top_modifile
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Session("loginname") Is Nothing OrElse Session("loginname").ToString() = "" Then
Response.Write("<script>alert('用户登录时间超时,请重新登录');document.location='/admin.aspx'</script>")
Response.[End]()
End If
If Not Page.IsPostBack Then
If Request("id") IsNot Nothing AndAlso Request("id") <> "" Then
Using oleconn As New OleDbConnection()
oleconn.ConnectionString = ConfigurationManager.ConnectionStrings("oleConnectionString").ConnectionString
oleconn.Open()
Dim strSQL As String = "Select * From data where id=" + Request("id")
Dim command As New OleDbCommand(strSQL, oleconn)
Dim dataReader As OleDbDataReader = command.ExecuteReader()
If dataReader.Read() Then
titlename.Text = dataReader("name").ToString()
neirong.Text = dataReader("neirong").ToString()
End If
dataReader.Close()
oleconn.Close()
oleconn.Dispose()
End Using
End If
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
If Session("loginname") Is Nothing OrElse Session("loginname").ToString() = "" Then
Response.Write("<script>alert('用户登录时间超时,请重新登录');document.location='/admin.aspx'</script>")
Response.[End]()
End If
Try
Using oleconn As New OleDbConnection()
oleconn.ConnectionString = ConfigurationManager.ConnectionStrings("oleConnectionString").ConnectionString
oleconn.Open()
Dim strSQL As String = "update [data] set [name]='" + titlename.Text + "',neirong='" + neirong.Text + "' where id=" + Request("id")
Dim command As New OleDbCommand(strSQL, oleconn)
command.ExecuteNonQuery()
oleconn.Close()
oleconn.Dispose()
Response.Write("<script language='javascript'>window.confirm('已经修改添加!!');</script>")
Response.Write("<script language='javascript'>document.location='add.aspx';</script>")
End Using
Catch err As Exception
Dim str As String = err.Message.Replace("'", "")
Response.Write("<script>alert('" + str + "');</script>")
End Try
End Sub
End Class
- VB update
- VB developement news update
- vb.net query update
- [VB.NET]vb.net update 方面问题...
- [VB.NET]ADO.NET的Update问题
- update
- update
- update
- update
- update
- update
- update
- update
- update
- update
- update
- update
- Update()
- vc6.0中用GDIPlus实现加载动态gif图片(非MFC实现)
- silverlight 自定义控件基础篇(仿淘宝评论星级控件)
- linux神奇的系统请求----系统救命草
- Hash表(C++实现)
- linux系统调用的基本原理和技巧
- VB update
- C++0x新特性
- 动态编程简单示例
- linux文件include/asm/unisted.h为每个系统调用规定了唯一的编号
- 今日,ORACLE 11gR2 RAC大功告成
- 关于gentoo 报EAPI问题
- 用Erlang验证中华人民共和国公民身份号码
- usr/include/i386/asm/unistd_32.h
- 一,android开发环境的搭建——windows(上)