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

你可能感兴趣的文章
观察者模式
查看>>
Bzoj2882 工艺 [线性算法]
查看>>
Bzoj2251 [2010Beijing Wc]外星联络
查看>>
python 发送邮件
查看>>
在凡客四个月的工作总结
查看>>
Qt颜色下拉框
查看>>
31、springboot与任务
查看>>
【转】 一个fork的面试题
查看>>
20131108
查看>>
django.http.request中HttpRequest对象的一些属性与方法
查看>>
英文对应解释
查看>>
Robotics ToolBox机械臂仿真
查看>>
linux添加环境变量
查看>>
【uva 1312】Cricket Field(算法效率--技巧枚举)
查看>>
VS2017 MVC项目,新建控制器提示未能加载文件或程序集“Dapper.Contrib解决方法
查看>>
【ora-err】ORA-03113: end-of-file on communication channel
查看>>
00.索引-综述
查看>>
strcpy
查看>>
AC3 Rematrix
查看>>
C#之Windows Form Application与attribute
查看>>