|
Public Shared Function BeforeEdit(Page As System.Web.UI.Page,
parNewValues As OleDbParameterCollection, where As String) As Boolean
'Insert a record into 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",
OleDbType.VarChar).Value = "value1"
cmdInsert.Parameters.Add("@Param2",
OleDbType.VarChar).Value = "value2"
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 |