这是我的文件 Option Explicit On Option Strict On Imports System Imports System.Object Imports System.Web Imports System.Web.HttpResponse Imports System.Web.SessionState Imports System.Web.HttpCookie Imports Microsoft.VisualBasic Imports System.Net.CookieNamespace ArticleFun Public Class ArticleAllFunction Private _StrTemp As String Private _SuccessMsg As String Private _errmsg As String'************************************************* '函数名:gotTopic '作 用:截字符串,汉字一个算两个字符,英文算一个字符 '参 数:str ----原字符串 ' strlen ----截取长度 '返回值:截取后的字符串 '作者:陈作 '2004-10-2 '************************************************* Public Function gotTopic(ByRef Str As String, intStr As Integer) As String Dim PrivateStr As String = "" if Not (Str.Length)>0 Then Return PrivateStr Exit Function End If Dim PrivateStrLen As Integer,PrivateTempInt As Integer,PrivateTempIntCount As Integer,PrivateTempIntStrLen As Integer PrivateStr=Str.Replace(" "," ").Replace(""",Chr(34)).Replace(">",">").Replace("<","<") PrivateStrLen=PrivateStr.Length PrivateTempInt=0 For PrivateTempIntCount=1 To PrivateStrLen PrivateTempIntStrLen=Math.Abs(Asc(Mid(PrivateStr,PrivateTempIntCount,1))) If PrivateTempIntStrLen>255 Then PrivateTempInt+=2 Else PrivateTempInt+=1 End if if PrivateTempInt>=intStr Then PrivateStr=Microsoft.VisualBasic.Left(PrivateStr,PrivateTempIntCount)&"…" Exit For Else PrivateStr=Str end if Next PrivateTempIntCount PrivateStr=PrivateStr.Replace(" "," ").Replace(Chr(34),""").Replace(">",">").Replace("<","<") Return PrivateStr End Function '************************************************** '函数名:ReplaceBadChar '作 用:过滤非法的SQL字符 '参 数:strChar-----要过滤的字符 '返回值:过滤后的字符 '************************************************** Public Function ReplaceBadChar(ByRef StrChar As String) As String Dim PrivateStr As String If Len(StrChar)<0 Then PrivateStr="" Dim objCookie As HttpCookie objCookie=New HttpCookie("NewCookie","fdf") Response.Cookies.Add(objCookie) Else PrivateStr=StrChar.Replace("'","").Replace("*","").Replace("?","").Replace(",","").Replace(">","").Replace("<","").Replace("and","").Replace("or","").Replace(".","").Replace("select","") End If Return PrivateStr End Function '**************************************************** '属性:WriteSuccessMsg '作 用:显示成功提示信息 '参 数:无 '**************************************************** Public Property WriteSuccessMsg As String Set(Value As String) _SuccessMsg=Value End Set Get Dim StrText As String StrText = "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>恭喜你!</strong></td></tr> <tr class='tdbg'><td height='100' valign='top'><br>"+_SuccessMsg+"</td></tr> <tr align='center' class='tdbg'><td> </td></tr></table></body></html>" Return StrText End Get End Property'**************************************************** '属性:WriteErrMsg '作 用:显示错误提示信息 '参 数:无 '**************************************************** Public Property WriteErrMsg As String Set(Value As String) _errmsg=Value End Set Get Dim StrText As String StrText+="<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr><tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>"+_errmsg+"</td></tr><tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)'><< 返回上一页</a></td></tr></table></body></html>" Return StrText End Get End PropertyEnd Class'类的结束 End Namespace cop.bat set indir=H:\aspnet\Travel\Administrator\ArticleFun.vb set outdir=H:\aspnet\bin\ArticleFun set assemblies=System.dll,System.Web.dlL,System.Data.dll,System.Xml.dll,System.Web.Services.dll vbc /t:library /out:%outdir% %indir% /r:%assemblies% pause
这样就可以了:Option Explicit On Option Strict On Imports System Imports System.Web Imports System.Web.HttpContextNamespace ArticleFun Public Class ArticleAllFunction Private _StrTemp As String Private _SuccessMsg As String Private _errmsg As String '************************************************* '函数名:gotTopic '作 用:截字符串,汉字一个算两个字符,英文算一个字符 '参 数:str ----原字符串 ' strlen ----截取长度 '返回值:截取后的字符串 '作者:陈作 '2004-10-2 '************************************************* Public Function gotTopic(ByRef Str As String, ByVal intStr As Integer) As String Dim PrivateStr As String = "" If Not (Str.Length) > 0 Then Return PrivateStr Exit Function End If Dim PrivateStrLen As Integer, PrivateTempInt As Integer, PrivateTempIntCount As Integer, PrivateTempIntStrLen As Integer PrivateStr = Str.Replace(" ", " ").Replace(""", Chr(34)).Replace(">", ">").Replace("<", "<") PrivateStrLen = PrivateStr.Length PrivateTempInt = 0 For PrivateTempIntCount = 1 To PrivateStrLen PrivateTempIntStrLen = Math.Abs(Asc(Mid(PrivateStr, PrivateTempIntCount, 1))) If PrivateTempIntStrLen > 255 Then PrivateTempInt += 2 Else PrivateTempInt += 1 End If If PrivateTempInt >= intStr Then PrivateStr = Microsoft.VisualBasic.Left(PrivateStr, PrivateTempIntCount) & "…" Exit For Else PrivateStr = Str End If Next PrivateTempIntCount PrivateStr = PrivateStr.Replace(" ", " ").Replace(Chr(34), """).Replace(">", ">").Replace("<", "<") Return PrivateStr End Function '************************************************** '函数名:ReplaceBadChar '作 用:过滤非法的SQL字符 '参 数:strChar-----要过滤的字符 '返回值:过滤后的字符 '************************************************** Public Function ReplaceBadChar(ByRef StrChar As String) As String Dim PrivateStr As String If Len(StrChar) < 0 Then PrivateStr = "" Dim objCookie As HttpCookie objCookie = New HttpCookie("NewCookie", "fdf") Current.Response.Cookies.Add(objCookie) Else PrivateStr = StrChar.Replace("'", "").Replace("*", "").Replace("?", "").Replace(",", "").Replace(">", "").Replace("<", "").Replace("and", "").Replace("or", "").Replace(".", "").Replace("select", "") End If Return PrivateStr End Function '**************************************************** '属性:WriteSuccessMsg '作 用:显示成功提示信息 '参 数:无 '**************************************************** Public Property WriteSuccessMsg() As String Set(ByVal Value As String) _SuccessMsg = Value End Set Get Dim StrText As String StrText = "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>恭喜你!</strong></td></tr> <tr class='tdbg'><td height='100' valign='top'><br>" + _SuccessMsg + "</td></tr> <tr align='center' class='tdbg'><td> </td></tr></table></body></html>" Return StrText End Get End Property '**************************************************** '属性:WriteErrMsg '作 用:显示错误提示信息 '参 数:无 '**************************************************** Public Property WriteErrMsg() As String Set(ByVal Value As String) _errmsg = Value End Set Get Dim StrText As String StrText += "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr><tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>" + _errmsg + "</td></tr><tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)'><< 返回上一页</a></td></tr></table></body></html>" Return StrText End Get End Property End Class '类的结束 End Namespace
Option Explicit On
Option Strict On
Imports System
Imports System.Object
Imports System.Web
Imports System.Web.HttpResponse
Imports System.Web.SessionState
Imports System.Web.HttpCookie
Imports Microsoft.VisualBasic
Imports System.Net.CookieNamespace ArticleFun
Public Class ArticleAllFunction
Private _StrTemp As String
Private _SuccessMsg As String
Private _errmsg As String'*************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'作者:陈作
'2004-10-2
'*************************************************
Public Function gotTopic(ByRef Str As String, intStr As Integer) As String
Dim PrivateStr As String = ""
if Not (Str.Length)>0 Then
Return PrivateStr
Exit Function
End If
Dim PrivateStrLen As Integer,PrivateTempInt As Integer,PrivateTempIntCount As Integer,PrivateTempIntStrLen As Integer
PrivateStr=Str.Replace(" "," ").Replace(""",Chr(34)).Replace(">",">").Replace("<","<")
PrivateStrLen=PrivateStr.Length
PrivateTempInt=0
For PrivateTempIntCount=1 To PrivateStrLen
PrivateTempIntStrLen=Math.Abs(Asc(Mid(PrivateStr,PrivateTempIntCount,1)))
If PrivateTempIntStrLen>255 Then
PrivateTempInt+=2
Else
PrivateTempInt+=1
End if
if PrivateTempInt>=intStr Then
PrivateStr=Microsoft.VisualBasic.Left(PrivateStr,PrivateTempIntCount)&"…"
Exit For
Else
PrivateStr=Str
end if
Next PrivateTempIntCount
PrivateStr=PrivateStr.Replace(" "," ").Replace(Chr(34),""").Replace(">",">").Replace("<","<")
Return PrivateStr
End Function
'**************************************************
'函数名:ReplaceBadChar
'作 用:过滤非法的SQL字符
'参 数:strChar-----要过滤的字符
'返回值:过滤后的字符
'**************************************************
Public Function ReplaceBadChar(ByRef StrChar As String) As String
Dim PrivateStr As String
If Len(StrChar)<0 Then
PrivateStr=""
Dim objCookie As HttpCookie
objCookie=New HttpCookie("NewCookie","fdf")
Response.Cookies.Add(objCookie)
Else
PrivateStr=StrChar.Replace("'","").Replace("*","").Replace("?","").Replace(",","").Replace(">","").Replace("<","").Replace("and","").Replace("or","").Replace(".","").Replace("select","")
End If
Return PrivateStr
End Function
'****************************************************
'属性:WriteSuccessMsg
'作 用:显示成功提示信息
'参 数:无
'****************************************************
Public Property WriteSuccessMsg As String
Set(Value As String)
_SuccessMsg=Value
End Set
Get
Dim StrText As String
StrText = "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>恭喜你!</strong></td></tr> <tr class='tdbg'><td height='100' valign='top'><br>"+_SuccessMsg+"</td></tr> <tr align='center' class='tdbg'><td> </td></tr></table></body></html>"
Return StrText
End Get
End Property'****************************************************
'属性:WriteErrMsg
'作 用:显示错误提示信息
'参 数:无
'****************************************************
Public Property WriteErrMsg As String
Set(Value As String)
_errmsg=Value
End Set
Get
Dim StrText As String
StrText+="<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr><tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>"+_errmsg+"</td></tr><tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)'><< 返回上一页</a></td></tr></table></body></html>"
Return StrText
End Get
End PropertyEnd Class'类的结束
End Namespace
cop.bat
set indir=H:\aspnet\Travel\Administrator\ArticleFun.vb
set outdir=H:\aspnet\bin\ArticleFun
set assemblies=System.dll,System.Web.dlL,System.Data.dll,System.Xml.dll,System.Web.Services.dll
vbc /t:library /out:%outdir% %indir% /r:%assemblies%
pause
Option Strict On
Imports System
Imports System.Web
Imports System.Web.HttpContextNamespace ArticleFun
Public Class ArticleAllFunction
Private _StrTemp As String
Private _SuccessMsg As String
Private _errmsg As String '*************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'作者:陈作
'2004-10-2
'*************************************************
Public Function gotTopic(ByRef Str As String, ByVal intStr As Integer) As String
Dim PrivateStr As String = ""
If Not (Str.Length) > 0 Then
Return PrivateStr
Exit Function
End If
Dim PrivateStrLen As Integer, PrivateTempInt As Integer, PrivateTempIntCount As Integer, PrivateTempIntStrLen As Integer
PrivateStr = Str.Replace(" ", " ").Replace(""", Chr(34)).Replace(">", ">").Replace("<", "<")
PrivateStrLen = PrivateStr.Length
PrivateTempInt = 0
For PrivateTempIntCount = 1 To PrivateStrLen
PrivateTempIntStrLen = Math.Abs(Asc(Mid(PrivateStr, PrivateTempIntCount, 1)))
If PrivateTempIntStrLen > 255 Then
PrivateTempInt += 2
Else
PrivateTempInt += 1
End If
If PrivateTempInt >= intStr Then
PrivateStr = Microsoft.VisualBasic.Left(PrivateStr, PrivateTempIntCount) & "…"
Exit For
Else
PrivateStr = Str
End If
Next PrivateTempIntCount
PrivateStr = PrivateStr.Replace(" ", " ").Replace(Chr(34), """).Replace(">", ">").Replace("<", "<")
Return PrivateStr
End Function
'**************************************************
'函数名:ReplaceBadChar
'作 用:过滤非法的SQL字符
'参 数:strChar-----要过滤的字符
'返回值:过滤后的字符
'**************************************************
Public Function ReplaceBadChar(ByRef StrChar As String) As String
Dim PrivateStr As String
If Len(StrChar) < 0 Then
PrivateStr = ""
Dim objCookie As HttpCookie
objCookie = New HttpCookie("NewCookie", "fdf")
Current.Response.Cookies.Add(objCookie)
Else
PrivateStr = StrChar.Replace("'", "").Replace("*", "").Replace("?", "").Replace(",", "").Replace(">", "").Replace("<", "").Replace("and", "").Replace("or", "").Replace(".", "").Replace("select", "")
End If
Return PrivateStr
End Function
'****************************************************
'属性:WriteSuccessMsg
'作 用:显示成功提示信息
'参 数:无
'****************************************************
Public Property WriteSuccessMsg() As String
Set(ByVal Value As String)
_SuccessMsg = Value
End Set
Get
Dim StrText As String
StrText = "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>恭喜你!</strong></td></tr> <tr class='tdbg'><td height='100' valign='top'><br>" + _SuccessMsg + "</td></tr> <tr align='center' class='tdbg'><td> </td></tr></table></body></html>"
Return StrText
End Get
End Property '****************************************************
'属性:WriteErrMsg
'作 用:显示错误提示信息
'参 数:无
'****************************************************
Public Property WriteErrMsg() As String
Set(ByVal Value As String)
_errmsg = Value
End Set
Get
Dim StrText As String
StrText += "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br><table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center><tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr><tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>" + _errmsg + "</td></tr><tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)'><< 返回上一页</a></td></tr></table></body></html>"
Return StrText
End Get
End Property End Class '类的结束
End Namespace
谢谢,编译通过,