博客
关于我
强烈建议你试试无所不能的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/

你可能感兴趣的文章
云虚机选购指南之二云虚拟主机试用帮助文档
查看>>
女友眼中的IT男
查看>>
Excel连接
查看>>
java基础-多线程学习
查看>>
WPF打印原理,自定义打印
查看>>
HTML5 5
查看>>
箭头css
查看>>
Python入门,以及简单爬取网页文本内容
查看>>
顺丰科技笔试回忆
查看>>
excel技巧
查看>>
通用防SQL注入漏洞程序(Global.asax方式)
查看>>
服务器进程为何通常fork()两次
查看>>
python中的logger模块
查看>>
9.3、理解作用域与全局变量
查看>>
ios序列化最终方案
查看>>
HttpMessageConverter 专题
查看>>
oracle系统包——dbms_random用法及order by 小结(转)
查看>>
android布局基础及范例:人人android九宫格布局
查看>>
Entity Framework数据库初始化四种策略
查看>>
hdu5033 Building (单调栈+)
查看>>