AutoThrCode 三層結構業務層代碼自動產生工具

來源:互聯網
上載者:User
請看下面樣本:
資料表結構如下:


產生的 屬性成員 和 添加,更新的代碼:


'AutoThrCode自動產生三層結構商務邏輯層代碼
'IsDotNet 著作權
'作者:夢蟲
'Msn:IsDotNet@MsN.CoM
'Http://www.IsDotNet.com
'本代碼引用 IsDotNet.Data.SqlDbHelper 類,請將 AdoHelper.dll 拷貝到WEB程式的BIN目錄下
'請在WEB程式的web.config檔案的節設定資料庫連接字串,"ConnectionString" value="Server=(local); database=databasename; User ID=sa; Password=sa;" />

Imports System
Imports System.Data
Imports System.Data.SqlClient

Class DBShippers

'屬性成員ErrMsg
Private _ErrMsg As String
Public Property [ErrMsg] As String
Get
Return Me._Errmsg
End Get
Set(ByVal Value As String)
Me._Errmsg = Value
End Set
End Property

'屬性成員:ShipperID
Private intShipperid As Integer
Public Property [ShipperID] As Integer
Get
Return Me.intShipperid
End Get
Set(ByVal Value As Integer )
Me.intShipperid = Value
End Set
End Property

'屬性成員:CompanyName
Private strCompanyname As String
Public Property [CompanyName] As String
Get
Return Me.strCompanyname
End Get
Set(ByVal Value As String )
Me.strCompanyname = Value
End Set
End Property

'屬性成員:Phone
Private strPhone As String
Public Property [Phone] As String
Get
Return Me.strPhone
End Get
Set(ByVal Value As String )
Me.strPhone = Value
End Set
End Property

'添加
Public Function Shippers_Insert() As Boolean
Dim db As New IsDotNet.Data.SqlDbHelper
Dim strSql As String = "Insert Into [Shippers] ([CompanyName],[Phone]) values (@CompanyName,@Phone)"
Dim param() As SqlParameter = { _
db.MakeInParam("@CompanyName", SqlDbType.NVarChar, 40, Me.strCompanyname) , _
db.MakeInParam("@Phone", SqlDbType.NVarChar, 24, Me.strPhone) _
}
If db.Execute(strSql,param) Then
Return True
Else
Me._ErrMsg = db.ErrMsg
Return False
End If
End Function


'更新
Public Function Shippers_Update() As Boolean
Dim db As New IsDotNet.Data.SqlDbHelper
Dim strSql As String = "Update [Shippers] Set [CompanyName]=@CompanyName,[Phone]=@Phone where [ShipperID]=@ShipperID"
Dim param() As SqlParameter = { _
db.MakeInParam("@CompanyName", SqlDbType.NVarChar, 40, Me.strCompanyname) , _
db.MakeInParam("@Phone", SqlDbType.NVarChar, 24, Me.strPhone) , _
db.MakeInParam("@ShipperID", SqlDbType.Int, 0, Me.intShipperid) _
}
If db.Execute(strSql, param) Then
Return True
Else
Me.ErrMsg = db.ErrMsg
Return False
End If
End Function
End Class

此程式部分介面截屏


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.