Hi,
This is fine, but if I want to append more fields onto the end of the
records c# keeps throwing an exception as it is not happy about optional
parameters. Even if I enter the correct types for the parameters it still
throws an exception stating one of the type or data is incorrect but the code
work fine in VB6
See if below:
using System;
using ADODB;
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
ADODB.Recordset objRecordSet= new ADODB.Recordset();
objRecordSet.ActiveConnection = null;
objRecordSet.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
objRecordSet.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic;
objRecordSet.Fields.Append
("field1",ADODB.DataTypeEnum.adChar,10,ADODB.FieldAttributeEnum.adFldMayBeNull ,"test");
//objRecordSet.Open();
}
}
}