adding & updating new record

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.


regards,
sanyogita
sanyogitaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sbrown2kCommented:
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.

so:

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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vippxCommented:
Hi,

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.
0
sanyogitaAuthor Commented:
Pl. close this question

Sanyogita
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.