|
Public Shared Function BeforeEdit(Page As System.Web.UI.Page,
parNewValues As OleDbParameterCollection, where As String) As Boolean
'Save new data in another table
Dim sSQLInsert As String = "insert into
[AnotherTable] ([Field1], [Field2]) values (@Param1, @Param2)"
Dim cn As New OleDbConnection(func.GetConnectionStr())
Dim cmdInsert As OleDbCommand = new OleDbCommand(sSQLInsert, cn)
cmdInsert.CommandType = System.Data.CommandType.Text
cmdInsert.Parameters.Add("@Param1",
parNewValues(1).OleDbType).Value = parNewValues(1).Value
cmdInsert.Parameters.Add("@Param2",
parNewValues(2).OleDbType).Value = parNewValues(2).Value
cn.Open()
cmdInsert.ExecuteNonQuery()
cn.Close()
Return True
' return true if you like to proceed with editing
this record
' return false in other case
End Function |