cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Connor55
Resolver I
Resolver I

SQL Form not submitting

See the image below, I'm not sure why I'm getting an error.

 

I have a Gallery (datasource is a SQL database called Pipeline), where I'm using an icon to Set(varPipeline, ThisItem).

I have a form, data is set to Pipeline - and item is set to varPipeline.  However, when I run SubmitForm(Form1)), I get the error below.  Any ideas?

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @Connor55 ,

Could you please show more details about the error message within your "Submit" button?

Have you defined a proper Primary Key within your SQL Table ('[dbo].[Pipeline]')?

 

Firstly, please make sure you have defined proper Primary Key within your SQL Table. It is known limits with SQL Server connector in PowerApps, please check the following article for more details:

https://docs.microsoft.com/en-us/connectors/sql/#known-issues-and-limitations

 

If you want to use a Edit form to edit the selected item within the Gallery, I think it is not necessary to initialize a variable to store the selected item in your Gallery. Please take a try with the following workaround:

Set the Items property of the Gallery to following:

'[dbo].[Pipeline]'

 

Set the DataSource property of the Edit form to following:

'[dbo].[Pipeline]'

set the Item property of the Edit form to following:

Gallery.Selected

Please take a try with above solution, check if the issue is solved.

 

Also please check if you have defined some Required fields in your SQL Table, if so, please make sure you have enabled them within your Edit form, and provide proper values for these Required fields.

 

In addition, you could also consider submit the form data back to your SQL Table using Patch function instead of SubmitForm function. Set the OnSelect property of the "Submit" button to following:

Patch(
      '[dbo].[Pipeline]',
      Gallery1.Selected,
      Form1.Updates
)

or

Patch(
      '[dbo].[Pipeline]',
      LookUp('[dbo].[Pipeline]', 'Primary Key Column' = Gallery1.Selected.'Primary Key Column'),
      Form1.Updates
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-xida-msft 

Thanks for the help!  I have no idea what changed - but it's all working fine now.  

Hi @Connor55 ,

Have you solved your problem?

Is the solution I provided above helpful in your scenario?

 

If you have solved your problem, and the solution I provided above is helpful in your scenario, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,461)