adding & updating new record

Posted on 2004-11-03
Last Modified: 2010-04-17
I am working with Informix & vb 6.0. I hav done connectivtity through MS OLE DB for ODBC drivers.
I have made a form in which I want to add a blank record & update in table. In a form also it should show blank fields on clicking add button.
I am using rs.addnew & rs.update for this. Is it proper or not ? rs.update is giving me syntax error.
Pl.give me correct solution.

Question by:sanyogita
    LVL 1

    Accepted Solution

    My suggestion would be to solve it in SQL directly.
    Just get the data you need and stick in the database with an INSERT statement.


    dim query as string
    query = "insert into my_table values('value_for_col 1', 'value for col 2', some_number, ..... )"

    then issue the query as an update. Dont remember the exact vb6/ODBC syntax, but should
    be something like ExecuteUpdate().

    If you need to do it two phases for some reason, you can always
    do a partial insert and then use an update query (once again, issue as an ExecuteUpdate ...).
    I think ExecuteUpdate is a function of the connection as you dont need to have a recordset to do it.

    - sbrown2k
    LVL 3

    Assisted Solution


    If your database has a primary key that needs to be explicitly added then update() would raise an error. In that case set your database to have the primary field as an auto incrementing field and make sure that there are no fields in your DB has any required = true or allowZeroLength = false settings.

    Author Comment

    Pl. close this question


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    This is an explanation of a simple data model to help parse a JSON feed
    A short article about problems I had with the new location API and permissions in Marshmallow
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now