none
ADO open and AddNew method for Large database

    Question

  • Hi,

    I am working with ADO and VB.NET for an application. I am using the standard ADO methods to open a table to AddNew record. However as this table is growing quite large it is taking longer to open. Is there a way to add new records without opening the whole table? . Insert statement gets too large so would still prefer AddNew method if possible. 

    Monday, February 08, 2010 2:59 PM

Answers

  • Hi,

    I am working with ADO and VB.NET for an application. I am using the standard ADO methods to open a table to AddNew record. However as this table is growing quite large it is taking longer to open. Is there a way to add new records without opening the whole table? . Insert statement gets too large so would still prefer AddNew method if possible. 


    No there is not. the only way to add a new "Row" is by using Insert. What do you mean By Too large? As you know, with ADO you have to load the whole table and perform the task you want. That why MS made it easy for programer, using .Net and its all features.

    Is there any reason for you not to move to .Net and its whole features? 

    OOpp

    try it please, am not sure if will works:

    Cnxn = New ADODB.Connection
    strCnxn = "Provider='sqloledb';Data Source='scramjet';" & _
    "Initial Catalog='testdb';Integrated Security='SSPI';"
    Cnxn.Open(strCnxn)

    rstEmp = New ADODB.Recordset
    strSQL = "tblEmployee"
    rstEmp.Open(strSQL, strCnxn,ADODB.CursorTypeEnum.adOpenKeyset,ADODB.LockTypeEnum.adLockOptimistic)

    ' Get data from the user
    strEmpID = "70"
    strEmpName = "John Doe"

    rstEmp.AddNew()
    rstEmp!EmpID.value = strEmpID
    rstEmp.Update()


    rstEmp.Close()
    Cnxn.Close()
    rstEmp = Nothing
    Cnxn = Nothing


    Just Be Humble Malange!
    • Marked as answer by Jeff Shan Monday, February 15, 2010 1:59 AM
    Monday, February 08, 2010 3:51 PM