Problem trying to update a dataset - InfoPath Dev
in

InfoPath Dev

Problem trying to update a dataset

Last post 08-18-2005 08:55 PM by Agni Jonnalagadda. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-16-2005 12:33 PM

    • Annie2002
    • Not Ranked
    • Joined on 08-16-2005
    • South Africa
    • Posts 1

    Problem trying to update a dataset

    I have created a table (CUSTOMERS) in the SQL database with the following parameters:

    Name datatype length
    CustomerID int 4
    CustomerName varchar 50
    CustomerAddress varchar 250

    I'm using a stored procedure: GetCustomersbyID:

    Alter procedure dbo.GetCustomersbyID
    @id int

    AS
    select * from Customers
    where CustomerID = @id
    return

    I then use a web service to retrieve this dataset which is displayed on a dropdown list in an infopath form from which you can select a customer name and once the name is selected the rest of the fields are populated using the customerID. The problem i am having is that i don't know to update this dataset to reflect the changes to this dataset

    I tried the following:
    I created a stored procedure "UpdateCustomer":
    ALTER PROCEDURE dbo.UpdateCustomers

    @id int,
    @customername varchar(50),
    @customeraddress varchar(250),

    UPDATE Customers
    SET Custo CustomerName = @customername, CustomerAddress = @customeraddress
    WHERE CustomerID = @id

    Then i use the following web service code:
    public void update (DataSet ds)
    {
    sqlConnection1.open();
    sqlDataAdapater1.update(ds);
    sqlConnection1.close();
    }
    The sqlDataAdapter is configured with the storedprocedure GetCustomersbyID for the select command and UpdateCustomers for the update command

    Then in the infopath form i use the update function for the main submit and geCustomerbyID function for the main query. But this just doesnot update the database when i make changes to the fields in the form and submit

    If anyone has any suggestions please let me know i'm really struggling with this


  • 08-17-2005 12:08 PM In reply to

    Re: Problem trying to update a dataset

    Hi Annie2002,
    Welcome to the Forum!
    I sorry I did not understand your problem fully, Do you want to update data in the InfoPath or the data in the database?


    Agni
    InfoPath Dev India
  • 08-18-2005 08:55 PM In reply to

    Re: Problem trying to update a dataset

    From Annie in Email

    You asked me if I am trying to update the database or the infopath form.
    I am actually trying to do both. I am trying to update the fields in the
    infopath form and i assumed that once i click the submit button it will update
    the database as well. But unfortunately it doesn't do either.


    Please if you have any suggestions as to how I can fix this problem please let
    me know

    **************************************
    REPLY

    How do you want to update the database?
    Are you submitting data back to webservice?
    or are you writing code using SqlConnection to submit data to database directly?

    Can you give the code that you are using to update the dataset in InfoPath and code to update the Database here. By looking at you code i might get some idea.

    Agni
    InfoPath Dev India
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.