Editing database records w/ infopath

L

lisa

I know there are capabilities in infopath where you can add a new record to a database and also query a database, so I was wondering if there is any way to edit or delete records in a database using infopath. If so how do I go about doing that?
 
S

Stanley

Lisa,

Try this piece of code:

var objADOAdapter;

objADOAdapter = XDocument.DataObjects("Gegevens").QueryAdapter;
//XDocument.UI.Alert("Connection string: " + objADOAdapter.Connection);

oConn = new ActiveXObject("ADODB.Connection");
oConn.ConnectionString = objADOAdapter.Connection //XDocument.QueryAdapter.Connection;
//oConn.ConnectionTimeout = XDocument.QueryAdapter.Timeout;
oConn.Open();
var strSQL;
strSQL = "INSERT INTO Gegevens(Naam,Adres,Woonplaats) VALUES('" + XDocument.DOM.selectSingleNode("//my:txtName").text + "','" + XDocument.DOM.selectSingleNode("//my:txtAddress").text + "','" + XDocument.DOM.selectSingleNode("//my:txtCity").text + "')";
XDocument.UI.Alert(strSQL);
oConn.Execute(strSQL);
 
R

Roger Jennings

Here's the process for updating or deleting records declaratively (i.e., no
code):

Add a button to the form, name the button Submit Changes (or the like), and
select (in the Action list) Submit to open the Submitting Forms dialog.
Click OK (or Submit Options if you want to specify custom messages for
submittal success and failure.)

Do the same for a Delete Record button, but select Delete & Submit in the
Action list. If you have dependent records in a repeating table, you must
delete them before deleting the master (parent) record if your database
doesn't have cascading deletions enabled.

--rj

lisa said:
I know there are capabilities in infopath where you can add a new record
to a database and also query a database, so I was wondering if there is any
way to edit or delete records in a database using infopath. If so how do I
go about doing that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top