博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
弹出无边框网页的Javscrpt代码
阅读量:7210 次
发布时间:2019-06-29

本文共 2909 字,大约阅读时间需要 9 分钟。

Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.OleDb
ContractedBlock.gif
ExpandedBlockStart.gif
1None.gif  ''关闭连接
2ExpandedBlockStart.gifContractedBlock.gif    Sub CloseConn()Sub CloseConn()
3InBlock.gif        Conn.Dispose()
4ExpandedBlockEnd.gif    End Sub
1
ExpandedBlockStart.gif
ContractedBlock.gif
ublic 
Class Config
Class Config
2InBlock.gif    Public conn As OleDbConnection
3InBlock.gif
4InBlock.gif    Public StrAdminName As String   ''管理用户名
5InBlock.gif    Public StrPassword As String    ''密码
6InBlock.gif    Public StrLoginTime As String   ''登录时间 
7InBlock.gif
ContractedBlock.gif
ExpandedBlockStart.gif
 1ExpandedBlockStart.gifContractedBlock.gif  Function OpenConn()Function OpenConn()
 2InBlock.gif        ''连接数据库字符串
 3InBlock.gif        Dim connStr As String
 4InBlock.gif        connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
 5InBlock.gif        & HttpContext.Current.Request.ServerVariables("APPL_PHYSICAL_PATH") _
 6InBlock.gif        & "App_Data\DataBase.mdb"
 7InBlock.gif        ''定义数据库连接
 8InBlock.gif        conn = New OleDbConnection(connStr)
 9InBlock.gif        conn.Open() ''打开
10InBlock.gif        Return False
11ExpandedBlockEnd.gif    End Function
ContractedBlock.gif
ExpandedBlockStart.gif
 1None.gif ''此函数获取管理用户登录信息
 2ExpandedBlockStart.gifContractedBlock.gif    Function MySet()Function MySet()
 3InBlock.gif        If IsNothing(HttpContext.Current.Request.Cookies("MyInfor")) Then
 4InBlock.gif            ''未登录的情况
 5InBlock.gif            HttpContext.Current.Response.Redirect("Default.aspx")
 6InBlock.gif        Else
 7InBlock.gif            ''已登录后的情况
 8InBlock.gif            Dim myCookie As HttpCookie = HttpContext.Current.Request.Cookies("MyInfor")
 9InBlock.gif            StrAdminName = myCookie("UserName")
10InBlock.gif            StrPassword = myCookie("Password")
11InBlock.gif            StrLoginTime = myCookie("LoginTime")
12InBlock.gif        End If
13InBlock.gif        Return False
14ExpandedBlockEnd.gif    End Function
ContractedBlock.gif
ExpandedBlockStart.gif
 1ExpandedBlockStart.gifContractedBlock.gif Function IsAdminLogined()Function IsAdminLogined() As Boolean
 2InBlock.gif        If IsNothing(HttpContext.Current.Request.Cookies("MyInfor")) Then
 3InBlock.gif            ''未登录的情况
 4InBlock.gif            IsAdminLogined = False
 5InBlock.gif        Else
 6InBlock.gif            '已登录后的情况
 7InBlock.gif            IsAdminLogined = True
 8InBlock.gif        End If
 9InBlock.gif        Return IsAdminLogined
10ExpandedBlockEnd.gif    End Function
ContractedBlock.gif
ExpandedBlockStart.gif
1ExpandedBlockStart.gifContractedBlock.gif Function md5()Function md5(ByVal Str As StringAs String
2InBlock.gif        md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Str"MD5")
3InBlock.gif        Return md5
4ExpandedBlockEnd.gif    End Function
ContractedBlock.gif
ExpandedBlockStart.gif
VB.NET操作JS代码
 1None.gif  ''设置警告对话框
 2ExpandedBlockStart.gifContractedBlock.gif    Function SetAlert()Function SetAlert(ByVal Str As StringAs String
 3InBlock.gif        HttpContext.Current.Response.Write("<script language=""JavaScript"" type=""text/JavaScript"">alert('" & Str & "');</script>")
 4InBlock.gif        Return False
 5ExpandedBlockEnd.gif    End Function
 6None.gif
 7None.gif    ''设置关闭窗口
 8ExpandedBlockStart.gifContractedBlock.gif    Function SetCloseWindow()Function SetCloseWindow() As String
 9InBlock.gif        HttpContext.Current.Response.Write("<script language=""JavaScript"" type=""text/JavaScript"">window.close();</script>")
10InBlock.gif        Return False
11ExpandedBlockEnd.gif    End Function
12None.gif
13None.gif    '地址跳转
14ExpandedBlockStart.gifContractedBlock.gif    Function SetLocation()Function SetLocation(ByVal Str As String)
15InBlock.gif        HttpContext.Current.Response.Write("<script language=""JavaScript"">" & Chr(13& " location=""" & Str & """<" & "/" & "script>")
16InBlock.gif        Return False
17ExpandedBlockEnd.gif    End Function
ContractedBlock.gif
ExpandedBlockStart.gif
 1ExpandedBlockStart.gifContractedBlock.gif Function MySqlDataSource()Function MySqlDataSource(ByVal Sql As StringAs DataView
 2InBlock.gif        Try
 3InBlock.gif            OpenConn()
 4InBlock.gif            Dim Da As OleDbDataAdapter
 5InBlock.gif            Dim Ds As New DataSet
 6InBlock.gif            ''sql 为传过来的查询语句
 7InBlock.gif            Da = New OleDbDataAdapter(Sql, conn)
 8InBlock.gif            Da.Fill(Ds, "temp")
 9InBlock.gif            CloseConn()
10InBlock.gif            MySqlDataSource = Ds.Tables("temp").DefaultView
11InBlock.gif            Return MySqlDataSource
12InBlock.gif        Catch ex As Exception
13InBlock.gif
14InBlock.gif        End Try
15ExpandedBlockEnd.gif    End Function
16None.gif
17ExpandedBlockStart.gifContractedBlock.gif    Function MySqlExcute()Function MySqlExcute(ByVal Sql As String)
18InBlock.gif        OpenConn()
19InBlock.gif        Dim cmd As OleDbCommand
20InBlock.gif        ''sql 为传过来的查询语句
21InBlock.gif        cmd = New OleDbCommand(Sql, conn)
22InBlock.gif        cmd.ExecuteNonQuery()
23InBlock.gif        CloseConn()
24InBlock.gif        Return False
25ExpandedBlockEnd.gif    End Function
26None.gif

转载地址:http://herum.baihongyu.com/

你可能感兴趣的文章
Freeradius, 执行 radtest, 出现错误
查看>>
数据库9:联结表 高级联结 组合查询 全文本搜索
查看>>
redis:Sentinel高可用方案
查看>>
Linux 系统故障排除
查看>>
我的友情链接
查看>>
Mysql汉子转拼音
查看>>
设置MySQL数据库超时
查看>>
一致性hash算法
查看>>
lua + redis 的去重队列
查看>>
web负载均衡(ipvsadm)(未成)
查看>>
抓取存储quota超过80%的users
查看>>
C语言经典算法100例
查看>>
速成CAD版本转换的教程
查看>>
CAD文件图纸过大,该怎么解决?
查看>>
Spring aop 切不进去原因。。
查看>>
PHP获取客户端IP
查看>>
php开发APP接口-封装通信接口改进版
查看>>
Android系统性能演变历程
查看>>
OSChina 周三乱弹 —— 打醒精神去瞌睡
查看>>
SSH 密钥登录linux
查看>>