Autothrcode three-layer structure business layer code generation tool

Source: Internet
Author: User
Tags integer
Take a look at the following example:
The data table structure is as follows:


Generated property members and added, updated code:


' Autothrcode automatic generation of three-tier structure business logic layer code
' Isdotnet All rights reserved
' Author: Dream worm
' Msn:isdotnet@msn.com
' Http://www.IsDotNet.com
' This code refers to the IsDotNet.Data.SqlDbHelper class, please copy the AdoHelper.dll to the Web program's Bin directory
' Please configure the database connection string in the section of the Web program's Web.config file, ' ConnectionString ' value= ' server= (local); Database=databasename; User Id=sa; Password=sa; "/>

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

Class dbshippers

' Attribute member 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

' Attribute member: 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

' Attribute member: 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

' Attribute member: 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

' Add
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, Me.strcompanyname), _
Db. Makeinparam ("@Phone", SqlDbType.NVarChar, Me.strphone) _
}
If db. Execute (Strsql,param) Then
Return True
Else
me._errmsg = db. ErrMsg
Return False
End If
End Function


' Update
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, Me.strcompanyname), _
Db. Makeinparam ("@Phone", SqlDbType.NVarChar, 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

This program part of the interface screen


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.