Inserting and updating data in SQL table - InfoPath Dev
in

InfoPath Dev

Inserting and updating data in SQL table

Last post 04-09-2013 12:20 PM by Volmiro. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 04-01-2013 08:39 PM

    Inserting and updating data in SQL table

    Hello, I created web service submitting data to SQL table, I did not use stored procedures. It was for one project Now, I think it is time to use stored procedures, I need to send data to sql table, and update the data in sql table when the InfoPath opens for reviewing. I'm not sure how to call stored procedure for updating data/inserting data from web service. Could you help me with it? http://www.bizsupportonline.net/infopath2007/use-receive-data-connection-execute-sql-server-stored-procedure.htm I followed the link above for inserting data, but it sends data to database, but also I get error in InfoPath Form. So, I'm looking for options, or better way to do it. What are your recommendations? Thanks in Advance Volmiro
  • 04-03-2013 07:29 AM In reply to

    Re: Inserting and updating data in SQL table

    Could anyone tell me how to call stored procedure for updating table in SQL from InfoPath 2010? Are there any article that I can follow? Thanks
  • 04-03-2013 07:48 AM In reply to

    Re: Inserting and updating data in SQL table

     So - the outline in the blog post you linked to is pretty good - what is the error you are getting when you try it?

    Hilary Stoupa

  • 04-03-2013 08:12 AM In reply to

    Re: Inserting and updating data in SQL table

    Hilary, Thanks for your reply. I attached the error. If you need, I can copy the whole text to here, but I think it will look ugly. My main concern is updating the sql table using InfoPath Form. I still can manage to submit data with my web service, but I'm not sure how to do when I want to update the data. Thanks
  • 04-03-2013 10:15 AM In reply to

    Re: Inserting and updating data in SQL table

     Okay - so you wrote a custom web service for inserting data? Can you modify that to delete / reinsert or update?

    If not and you are wanting to use a stored proc to update - can you walk through your code in debug to try to track down the error?

    Hilary Stoupa

  • 04-03-2013 12:19 PM In reply to

    Re: Inserting and updating data in SQL table

    Let me correct myself with the error above; I only get this error within SharePoint. It works fine with InfoPath Client. Yes, I wrote custom web service for inserting data. Yes, I can modify it, I'm not sure how to update the table. I mean here is my current lines for inserting data; (Actually there are more than three fields, but I only show couple of them) SqlCommand cmd = new SqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "INSERT INTO RequestForms" + "(LoggedInUser, Reason, IntakeID) " + "VALUES (@IntakeID, @LoggedInUser, @Reason)"; cmd.Parameters.AddWithValue("LoggedInUser", LoggedInUser); cmd.Parameters.AddWithValue("Reason", Reason); cmd.Parameters.AddWithValue("IntakeID", IntakeID); When I use UPDATE, I could not get the result, I think I do mistake somewhere... Thank You
  • 04-05-2013 07:26 AM In reply to

    Re: Inserting and updating data in SQL table

    Can anyone help me pls?
  • 04-05-2013 07:39 AM In reply to

    Re: Inserting and updating data in SQL table

     It is just so hard to help w/ incomplete info - I'm sorry. Is the above code from your web service? What is the error you get when you use Update? What is the code you used for Update? Have you tried running SQL profiler while updating?

    Hilary Stoupa

  • 04-05-2013 10:06 AM In reply to

    Re: Inserting and updating data in SQL table

    Hi, I Attached the code that I wrote for inserting. I don't get any error for Update. I tried to do something similar to the code in the link below under "Update Records Using Command Objects". http://msdn.microsoft.com/en-us/library/ms233819(v=vs.80).aspx I don't get error, it just does not update the table. Thanks for your reply and your time
  • 04-05-2013 11:28 AM In reply to

    Re: Inserting and updating data in SQL table

     I'd try again with the web service and run SQL Profiler to see what is happening when try to update.

    Hilary Stoupa

  • 04-09-2013 12:20 PM In reply to

    Re: Inserting and updating data in SQL table

    Hi,

    I am now able to insert and update sql table using web service. I just have a question. After I submit the InfoPath form, it sends the form to SQL Database table and SharePoint Library. So, when I open the submitted form, I managed to display the update button(it uses Update web service), but I cannot get the specific row to update.

    I want to open the submitted form, and it checks the primary key in sql table, and if it exists, I want to update it.

    Currently, I need to enter the primary key to check if it exists or not. How can I check it on form load?

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