db/ClsTEmployeeDbAccess.vb
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
Public Class ClsTEmployeeDbAccess
Inherits ClsBaseDbAccess
Public Sub New(ByVal s As String)
MyBase.New(s, TABLE_NAME_T_EMPLOYEE)
End Sub
''' <summary>
''' 两个参数,s - 连接字串;n - 表名
''' </summary>
''' <param name="s"></param>
''' <param name="n"></param>
Public Sub New(ByVal s As String, ByVal n As String)
MyBase.New(s, n)
End Sub
Public Function InsertEmployee(ByVal tmpCls As ClsTEmployee) As Integer
Try
Dim tmpSql As String
Dim tmpDbAccess = GetConnection()
Dim tmpParas(4) As OleDb.OleDbParameter
Dim tmpReturn As Integer
'打开数据库
tmpDbAccess.DbOpen()
'构造查询语句
tmpSql = "insert into [" & Me.AppTableName & "] ("
tmpSql &= "[EmployeeId],[EmployeeCode],[DepartmentId],[departmentName],[EmployeeName],[Contact]"
tmpSql &= ") values("
tmpSql &= "@EmployeeId,@EmployeeCode,@DepartmentId,@departmentName,@EmployeeName,@Contact"
tmpSql &= ")"
'构造参数集合
tmpParas(0) = New OleDb.OleDbParameter("@EmployeeId", OleDb.OleDbType.Integer)
tmpParas(1) = New OleDb.OleDbParameter("@EmployeeCode", OleDb.OleDbType.VarWChar)
tmpParas(2) = New OleDb.OleDbParameter("@DepartmentId", OleDb.OleDbType.Integer)
tmpParas(3) = New OleDb.OleDbParameter("@departmentName", OleDb.OleDbType.VarWChar)
tmpParas(4) = New OleDb.OleDbParameter("@EmployeeName", OleDb.OleDbType.VarWChar)
tmpParas(5) = New OleDb.OleDbParameter("@Contact", OleDb.OleDbType.VarWChar)
'为查询参数赋值
tmpParas(0).Value = tmpCls.EmployeeId
tmpParas(1).Value = tmpCls.EmployeeCode
tmpParas(2).Value = tmpCls.DepartmentId
tmpParas(3).Value = tmpCls.EmployeeName
tmpParas(4).Value = tmpCls.Contact
'执行更新查询(插入、修改、删除)
tmpReturn = tmpDbAccess.InsertData(tmpSql, tmpParas, True)
'关闭数据库
tmpDbAccess.DbClose()
Return tmpReturn
Catch ex As OleDb.OleDbException
后面还有 49 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
