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

你可能感兴趣的文章
java序列化
查看>>
谈谈NITE 2的第一个程序HandViewer
查看>>
VS2008 未响应 假死
查看>>
html5、css3及响应式设计入门
查看>>
Win10還原成最乾淨的狀態
查看>>
Java_InvokeAll_又返回值_多个线程同时执行,取消超时线程
查看>>
SaltStack作业
查看>>
单例设计
查看>>
springboot+缓存
查看>>
/*10个filter的属性*/ ---毛玻璃效果
查看>>
折半查找习题解答
查看>>
51单片机的P1
查看>>
[32]JSON
查看>>
3689: 异或之
查看>>
字符串模式匹配KMP算法
查看>>
Android Drawable和Bitmap图片之间转换
查看>>
Debian 8 安装 Nvidia 显卡驱动
查看>>
nginx静态文件访问
查看>>
SharePoint 2013中的默认爬网文件扩展名和分析文件类型
查看>>
c#-冒泡排序-算法
查看>>