I had some problems to create a disconnected ADO Recordset in C#. Finally I get it right.
public static Recordset CreateDisconnectedRecordset() { // Create new recordset var rs = new Recordset(); // Add some updatable fields rs.Fields.Append("name", DataTypeEnum.adVarChar, 20, FieldAttributeEnum.adFldUpdatable, Missing.Value); rs.Fields.Append("country", DataTypeEnum.adVarChar, 20, FieldAttributeEnum.adFldUpdatable, Missing.Value); // Open recordset rs.Open(Missing.Value, Missing.Value, CursorTypeEnum.adOpenUnspecified, LockTypeEnum.adLockUnspecified, 0); // Add data rs.AddNew(Missing.Value, Missing.Value); rs.Fields["name"].Value = "Anders"; rs.Fields["country"].Value = "Sweden"; rs.Update(Missing.Value, Missing.Value); return rs; }
ahhhhhh, thank you! this was a real life-saver!!!
ReplyDeleteGlad the post helped you.
ReplyDeleteHelped me too, much thanks.
ReplyDeleteBeen struggling with this and chanced upon this post. Thanks a ton!!
ReplyDeleteThanks Man.
ReplyDelete