Problem Inserting and Updating Data - InfoPath Dev
in

InfoPath Dev

Problem Inserting and Updating Data

Last post 01-14-2006 10:07 AM by Lewis68. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 01-12-2006 09:26 AM

    Problem Inserting and Updating Data

    Hello,

    I have a form that allows for inserting records in a SQL database. I also want it to query the database to find if the record exists. If it does I want to give the ability to update the data.

    The query works when the record exists. I can edit the data and submit it back to the database. However when the record doesn't exist and I query the database, all the fields become disabled.

    Is there any way around this?

    Thanks
  • 01-12-2006 11:35 PM In reply to

    Re: Problem Inserting and Updating Data

    Anyone?
  • 01-13-2006 02:36 AM In reply to

    Re: Problem Inserting and Updating Data

    Hi Lewis,
    If data that you are quering is not present in the DB then you will get zero rows from the DB.
    I guess your fields are directly bound to the DB returned data, if that is case when there is no data in the DB, controls that are bound to that fields will get disabled. Because in InfoPath controls do not exist without XML fields.

    Agni
    InfoPath Dev India
  • 01-13-2006 08:39 AM In reply to

    Re: Problem Inserting and Updating Data

    Hi Agni,

    Is there anyway around this?

    Thanks
  • 01-13-2006 08:51 AM In reply to

    Re: Problem Inserting and Updating Data

    If you still want to get user input even though it has no where to go in the database, you could create two sections. One section (with controls tied to SQL) will be visible when the row is present, the other (with controls bound to XML schema) will be visible when no row is returned from the DB. You would also want to modify your submit button.

    Hope this helps!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-13-2006 09:31 AM In reply to

    Re: Problem Inserting and Updating Data

    Hi Matt,

    However, it does have somewhere to go in the database, which is the same place it would go if the Query wasn't run, a New Record. If I did not call the Query, there would still not be a record in the database that the controls are bound to. How is that any different then if I call a query that returns no records? Forgive me, but I'm trying to understand the reason why it was designed this way.

    So I have to create two views with the same controls, one to Add records, and one to Edit them? One question I have: For the view that's tied to XML, how do I, in code, add a record to the db, and fill it with the fields in the XML file?

    Thanks for your help.
  • 01-14-2006 10:07 AM In reply to

    Re: Problem Inserting and Updating Data

    Can I, in code, execute "New Record"? The same as the button.

    If I put a New Record button on the form, and hit it after the query returns nil, it will add a new record and allow me to enter into the fields. So all I need to do is execute a "New Record" in code.

    Any idea's?

    Thanks.
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.