Dim strSql As String = ""
Dim myDv As DataView = New DataView()
Dim maxNo As Integer = 0
Dim sqlCa As SqlClient.SqlTransaction
'提取最大编号
strSql = "select IsNull(Max(flow_id), 0) + 1 from flow_manage"
myDv = Me.mySqlHelper.GetDataView(strSql, "flow_manage")
If myDv.Count > 0 Then
maxNo = Integer.Parse(myDv(0)(0))
End If
'复制流程
Me.CommonRule()
sqlCa = Me.sqlCon.BeginTransaction()
Me.sqlCmd.Transaction = sqlCa
strSql = "insert into flow_manage select " + maxNo.ToString() + ", flow_name,module_id,flow_re,deptid,isSelect,createType,0 from flow_manage where flow_id=" + flowId.ToString()
Me.sqlCmd.CommandText = strSql
Me.sqlCmd.ExecuteNonQuery()执行到这就说:
仅当使用了列的列表,并且 IDENTITY_INSERT 为 ON 时,才能在表 'flow_manage' 中为标识列指定显式值.
Dim myDv As DataView = New DataView()
Dim maxNo As Integer = 0
Dim sqlCa As SqlClient.SqlTransaction
'提取最大编号
strSql = "select IsNull(Max(flow_id), 0) + 1 from flow_manage"
myDv = Me.mySqlHelper.GetDataView(strSql, "flow_manage")
If myDv.Count > 0 Then
maxNo = Integer.Parse(myDv(0)(0))
End If
'复制流程
Me.CommonRule()
sqlCa = Me.sqlCon.BeginTransaction()
Me.sqlCmd.Transaction = sqlCa
strSql = "insert into flow_manage select " + maxNo.ToString() + ", flow_name,module_id,flow_re,deptid,isSelect,createType,0 from flow_manage where flow_id=" + flowId.ToString()
Me.sqlCmd.CommandText = strSql
Me.sqlCmd.ExecuteNonQuery()执行到这就说:
仅当使用了列的列表,并且 IDENTITY_INSERT 为 ON 时,才能在表 'flow_manage' 中为标识列指定显式值.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货