编写类库的有意思的问题!!大家贡献!!(走过路过千万不要错过啊!!超级经典)

azyue 2003-10-15 11:12:31
本人编写类库时想编写特性,使调用这移动到方法或属性时可以显示提示
查了好几本书和框架没有所的,请有经验的给点提示!!谢谢。
没有经验的竟请留意以下!!!!!!!!!!!::::::::::·!《》《》《》《》
<attribute()……??????
...全文
76 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sumtec 2003-10-15
  • 打赏
  • 举报
回复
如果你说的是IDE里面的自动提示,那么VB.NET自己不带这个功能,不过可以通过外部工具实现,在微软的101个例子里面有,你要去搜索一下了。attribute和这个没有关系。
azyue 2003-10-15
  • 打赏
  • 举报
回复
编写程序的调用者使用该类库时移动到给方法和属性时可以给出提示,怎么做???
使用什么特性,和名称空间啊!?????????????



azyue 2003-10-15
  • 打赏
  • 举报
回复
恩?不是吧,各位仁兄再努力给个提示好了啊。
要不就当成开发包装类库的啊论吧,我献给点离子,希望不要辜负啊!!
Imports System.Data.SqlClient
Imports System.Attribute
Imports System.ComponentModel
Imports System.Reflection
Public Interface Isql

End Interface

Namespace ClsOpSql '<AssemblyDescription("adsfasdf")> _

<AttributeUsage(AttributeTargets.Assembly)> _
Public Class ExcuteIdle
Dim cn As SqlConnection
<Browsable(True) > _
Sub New(ByVal strconnection As String)
cn = New SqlConnection(strconnection)
End Sub
'<Obsolete("fdsssssssss")> _
<Description("asdfsdafFDS")> _
Public Property az() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property
<Description("asdfdfs")> _
Public Function backds(ByVal strselect As String) As DataSet '返回dataset
Dim drt As SqlDataAdapter
Dim dstemp As DataSet
Try
cn.Open()
drt = New SqlDataAdapter(strselect, cn)
dstemp = New DataSet()
drt.Fill(dstemp)
Return dstemp
Finally
cn.Close()
End Try
End Function

Public Function BackRecord(ByVal strselect As String) '返回单条记录
Dim cm As New SqlCommand(strselect, cn)
Dim str As String
'Dim dr As SqlDataReader
Try
cn.Open()
'dr = cm.ExecuteReader()
'While dr.Read
' str = dr.Item(strfeild)
'End While
str = CStr(cm.ExecuteScalar())
Return str

Finally
cn.Close()
End Try
End Function
Public Function BackRecord(ByVal strselect As String, ByVal strfeild As String) As String '重载 BackRecordset
Dim cm As New SqlCommand(strselect, cn)
Dim str As String
Dim dr As SqlDataReader
Try
cn.Open()
dr = cm.ExecuteReader()
While dr.Read
str = dr.Item(strfeild)
End While
'str = CStr(cm.ExecuteScalar())
Return str

Finally
dr.Close()
cn.Close()
End Try
End Function


Public Function excucommand(ByVal strsqlexcu As String) As Boolean '运行sql命令
Dim cm As SqlCommand
Try
cn.Open()
cm = New SqlCommand(strsqlexcu, cn)
cm.ExecuteNonQuery()
Return True
Finally
cn.Close()
End Try
End Function

Public Function Trainexcu(ByVal str1 As String, ByVal str2 As String) As Boolean '进行事务处理
Dim train As SqlTransaction
Dim cm1 As New SqlCommand(str1, cn)
Dim cm2 As New SqlCommand(str2, cn)
cn.Open()
train = cn.BeginTransaction()
cm1.Transaction = train
cm2.Transaction = train
Try
cm1.ExecuteNonQuery()
cm2.ExecuteNonQuery()
train.Commit()
Return True
Catch e As SqlException
train.Rollback()
Throw e
Finally
cn.Close()
End Try
End Function

Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class



End Namespace

16,549

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧