C# : The Easy Way : How to Connect to SQL Server Database File (.mdf) in Visual Studio 2019



👨‍🏫 Please watch the top 3 most popular videos on my channel.

🥇 33 Million Views : Programming in Visual Basic .Net How to Connect Access Database to VB.NET : https://youtu.be/cwDqjmSmtMQ

🥈 13 Million Views : Visual Basic .Net : Search in Access Database - DataGridView BindingSource Filter (Part 1/2) : https://youtu.be/UoT2oava9ns

🥉 2 Million Views : Visual Basic .Net : Search in Access Database - DataGridView BindingSource Filter (Part 2/2) : https://youtu.be/e5Dvkw7moWg

💰 Donate $29 USD and Receive a free PDF Source Code of the above project:
https://www.paypal.com/paypalme/CodeAMinute/29USD
📧 Contact the instructor via this email: ibasskung@gmail.com

✔ This project is also included: (Export Data To Excel): https://youtu.be/whwQWX4sR7Y

💡 Premium Online Courses 💡

🎓 Master Visual Basic .NET and Access Database By Building the Point Of Sale System (POS)
📲 Enroll Now: https://bit.ly/2WcbRhX

🎓 Learn C# and SQL Server 2019 by Building Windows Forms Application with ADO.NET
📲 Enroll Now: https://bit.ly/37iLrRX

📚 See all courses here: https://bit.ly/2IJPxcm


🚀 4K UHD : Visual C# .NET Project : The Easy Way! - How to Connect to a SQL Server Database File (.mdf) in Visual Studio 2019 (Visual C# .NET .MDF Database Project).
🎦 Watch in 4K on YouTube: https://youtu.be/_cHmSLfsXOA

🎓 In this video tutorial you will learn step by step:
- How to Create a SQL Server database file (.mdf) in Visual Studio 2019.
- How to Connect to SQL Server Database file (.mdf) using Wizard (Without Writing Any Code!)
- How to Perform a Simple CRUD Operation using C# .NET and SQL Server database in less than 10 lines of code!
- How to Solve a Problem: TableAdapterManager.UpdateAll() not working.

🚀 Visual Basic .NET version: https://youtu.be/z6W8-g6i-ZE


C# Source Code by iBasskung.


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;


namespace CSMDFDatabase

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void employeesBindingNavigatorSaveItem_Click(object sender, EventArgs e)

        {

            // <auto-generated> This code was generated by a tool.

            this.Validate();

            this.employeesBindingSource.EndEdit();

            this.tableAdapterManager.UpdateAll(this.myDatabaseDataSet);

            // </auto-generated>

        }


        private void Form1_Load(object sender, EventArgs e)

        {

            // TODO: This line of code loads data into the 'myDatabaseDataSet.Employees' table. You can move, or remove it, as needed.

            // <auto-generated> This code was generated by a tool.

            this.employeesTableAdapter.Fill(this.myDatabaseDataSet.Employees);

            // </auto-generated>

        }


        private void refreshToolStripButton_Click(object sender, EventArgs e)

        {

            this.employeesTableAdapter.Fill(this.myDatabaseDataSet.Employees);

        }


        private void closeButton_Click(object sender, EventArgs e)

        {

            // Note: This is a comment.

            // Close this window.

            this.Close();

        }


        private void previousButton_Click(object sender, EventArgs e)

        {

            bindingNavigatorMovePreviousItem.PerformClick();

        }


        private void NextButton_Click(object sender, EventArgs e)

        {

            bindingNavigatorMoveNextItem.PerformClick();

        }


        private void addNewButton_Click(object sender, EventArgs e)

        {

            bindingNavigatorAddNewItem.PerformClick();

        }


        private void saveButton_Click(object sender, EventArgs e)

        {

            employeesBindingNavigatorSaveItem.PerformClick();

        }


        private void deleteButton_Click(object sender, EventArgs e)

        {

            bindingNavigatorDeleteItem.PerformClick();

        }


    }

}


📚 See all courses here: https://www.udemy.com/user/tanin-sangngam


Follow me around

✔ Want to get updates on new courses or other cool free stuff? Just follow me on social media if that's your thing!

📺 Pages:
📍 https://www.facebook.com/CodeAMinute
📍 https://www.facebook.com/IbasskungTutorial
📍 https://www.facebook.com/codewithibasskung
📍 https://www.facebook.com/iBasskungAcademy

📺 YouTube:
📍 https://www.youtube.com/c/iBasskung

📺 Udemy:
📍 https://www.udemy.com/user/tanin-sangngam

📺 Twitter:
📍 https://twitter.com/IBasskung

📺 Pinterest:
📍 https://www.pinterest.com/ibasskung

📺 Blogger:
📍 .NET: https://codeaminute.blogspot.com
📍 JAVA: https://javacodeminutes.blogspot.com
📍 VBA: https://vbacodeminutes.blogspot.com

💯 THANK YOU SO MUCH! 💯

#CSharp #VisualCSharp #FreeSourceCode #MDF #SQLServer #PointOfSale #POS #VisualStudio  

Comments