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

你可能感兴趣的文章
centos7 python2和python3共存
查看>>
rhel6.2配置在线yum源
查看>>
分级聚类算法
查看>>
Web Services 入门(之二)
查看>>
随机模拟MCMC和Gibbs Sampling
查看>>
网络安全是一种态度
查看>>
POJ1131 Octal Fractions
查看>>
mysql-ulogd2.sql
查看>>
119. Pascal's Triangle II - Easy
查看>>
349. Intersection of Two Arrays - Easy
查看>>
[算法练习]最长公共子串(LCS)
查看>>
p转c++
查看>>
树(tree)
查看>>
codevs——2645 Spore
查看>>
ssh服务之 远程登录和端口转发
查看>>
java环境配置正确,但是tomcat不能启动的解决办法
查看>>
我就是想找个人聊聊天,说说我这近四年来的经历
查看>>
不同的测试方法使用的场景
查看>>
Hadoop快速入门
查看>>
Problem S
查看>>