?
Solved

adding & updating new record

Posted on 2004-11-03
7
Medium Priority
?
178 Views
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.


regards,
sanyogita
0
Comment
Question by:sanyogita
3 Comments
 
LVL 1

Accepted Solution

by:
sbrown2k earned 100 total points
ID: 12490820
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
 
LVL 3

Assisted Solution

by:vippx
vippx earned 100 total points
ID: 12491131
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
 

Author Comment

by:sanyogita
ID: 13494067
Pl. close this question

Sanyogita
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

862 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