When creating a new form from a SQL database connection, there are a couple of things to remember in order to enable the Submit To Database feature.
The SQL tables used must have a primary key, unique constraint, or unique index. Without this you will receive the following error in the summary of the Data Connection Wizard:
Submit status: Not allowed - One or more of the tables in the data source do not have a primary key, unique constraint, or unique index.
The SQL database tables must not include the following data types: image, ntext, text. These are considered long data types and are not supported within InfoPath. If your tables include any of these data types you will receive the following error in the summary of the Data Connection Wizard:
Submit status: Not allowed - One or more of the columns in the data source has a long data type (text, ntext, hyperlink or image). Long data types are not supported.
Other things may prevent you from submitting to your database. Here's a couple of other reasons that will prevent you:
Submit status: Not allowed - A table is being used many times
Submit status: Not allowed - A many to one relationship might exist between two tables in the data source.
If you have successfully satisfied the conditions, the summary of the Data Connection Wizard will inform you that submit is enabled. To then submit to your database, perform the following steps:
- Drag a Button control into the view from the Controls task pane.
- Double-click the new button to open the Button Properties dialog box.
- On the General Tab, change the button action to Submit.
- On the Submitting Forms dialog box, the Submit To drop-down list box should have the value Database pre-selected. Click OK to accept the defaults.
- Click OK again to close the Button Properties dialog box.
That's it -- you're done! You are now set up to submit your form entries to your SQL database.
©2005 Greg Collins. All rights reserved. Licensed to Autonomy Systems, LLC for display on InfoPathDev.com.