C# Tutorial – Insert/Save data to SQL Database | FoxLearn

C# Tutorial – Insert/Save data to SQL Database | FoxLearn

Welcome to FoxLearn In this tutorial, I’ll show you how to insert data into sql database, then show the message in the system tray notification Right click on your project, then add the ADO.NET Entity Data Model to you project We will use the Northwind database to play the demo If you don’t have the Northwind database you can download it from the http://foxlearn.com website To play the demo, you need to add the datasource to your visual studio, then drag the datasource detail into your windows forms application Next, we will create a simple UI that allows you to insert data into the customer table As you can see, bindingsource control is automatically created when you drag data fields into your windows forms application The BindingSource component is designed to simplify the process of binding controls to an underlying data source The BindingSource component acts as both a conduit and a data source for other controls to bind to It provides an abstraction of your form’s data connection while passing through commands to the underlying list of data Additionally, you can add data directly to it, so that the component itself functions as a data source Drag a NotifyIcon from your visual toolbox into your windows forms application As you know, The NotifyIcon component displays icons in the status notification area of the taskbar for processes that run in the background, and would not otherwise have user interfaces To handle the insert event button, we will check if the data has been successfully inserted, we will use the NotifyIcon control to display the message To view the customer data, you can open the sql server to check if the data has been inserted Thank you for watching this video and don’t forget to subscribe to my channel


  • Monkey Baboo says:

    Good, thanks for sharing your knowledge.

  • Monkey Baboo says:

    Have any way to download notification of windows 10 and save it to database?

  • tankie says:

    Will you create a video on shopping carts and email receipts?

  • adam zbudniewek says:

    GREAt job!
    Will you create video with using valturos ? I think a lot of poepole should know how to use in in c# winforms for example with detection something in picturebox.
    PLease if you can.

    Best Wishes ,

  • kubex says:

    Will you create a video
    how to save the background color to a text file

  • alireza abedi says:


  • Mauricio Caterino says:

    I followed along, did the same and I get this error: System.Data.Entity.Validation.DbEntityValidationException


    Message=Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.



    at System.Data.Entity.Internal.InternalContext.SaveChangesAsync(CancellationToken cancellationToken)

    at System.Data.Entity.Internal.LazyInternalContext.SaveChangesAsync(CancellationToken cancellationToken)

    at System.Data.Entity.DbContext.SaveChangesAsync(CancellationToken cancellationToken)

    at System.Data.Entity.DbContext.SaveChangesAsync()

    at InsertDbApp.Form1.<btnInsert_Click>d__1.MoveNext() How do you debug this?

  • Mauricio Caterino says:

    I am not much of a fan of EntityFramework databinding. I would rather go coding all the way with dapper. By the way, Do you have some video that shows a master detail crud with no databinding using dapper? Lets say placing an order with its items.

Leave a Reply

Your email address will not be published. Required fields are marked *