About 22,500,000 results
Open links in new tab
  1. How to insert Records in Database using C# language?

    Aug 27, 2012 · using(var connection = new SqlConnection("connectionString")) { connection.Open(); var sql = "INSERT INTO Main(FirstName, SecondName) VALUES(@FirstName, @SecondName)"; using(var cmd = new SqlCommand(sql, connection)) { cmd.Parameters.AddWithValue("@FirstName", txFirstName.Text); cmd.Parameters.AddWithValue("@SecondName", txSecondName.Text); cmd ...

  2. Insert data into SQL Server from C# code - Stack Overflow

    To use your variable, you should parameterise your SQL query. string sql = "INSERT INTO student (name) values (@name)"; conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@name", SqlDbType.VarChar); cmd.Parameters["@name"].Value = test; cmd.ExecuteNonQuery();

  3. Basic Database Operations Using C# - GeeksforGeeks

    Jan 31, 2023 · In this article, you are going to learn about how to perform basic database operations using system.data.SqlClient namespace in C#. The basic operations are INSERT, UPDATE, SELECT and DELETE.

  4. Insert Records using Simple and Parameterized QueryC# SQL

    There are 2 ways to insert records in a table. Insert using Simple Query; Insert using Parameterized Query; Direct Insert Record in a Table. This is the easiest way to insert records into a table but I strongly avoid it because it is less secure than parameterized query. Syntax INSERT INTO table_name (column1, column2, column3, ...)

  5. Insert records into database (.NET Framework) - Visual Studio …

    Aug 26, 2024 · You can use the TableAdapter.Update method or one of the TableAdapter DBDirect methods (specifically, the TableAdapter.Insert method). This article describes how to insert records into a database for an application built with ADO.NET and the .NET Framework by using Visual Basic (VB) or C#.

  6. How to Insert Data into SQL Server Table Using C# - Web Dev …

    Aug 7, 2024 · In this tutorial, we have learned how to insert data into a SQL Server table using C#. By establishing a connection, creating an insert command, and executing it, you can seamlessly add new records to your database tables.

  7. Insert Data Into Database by Stored Procedure in ASP.Net C# - C#

    This article shows how to insert data into a database using ASP.Net C# and a Stored Procedure. I used several textboxes and a button. When the user clicks on the “Insert” button the data is saved into the database.

  8. SQL Insert Query in C# - Delft Stack

    Feb 16, 2024 · There are 2 main methods that can be used to insert records to a database in C#, the direct query method and the parameterized query method.

  9. A Comprehensive Guide on Inserting Data into SQL Server Using C#

    Jun 25, 2024 · In this guide, we will walk through the process of inserting data into SQL Server using C# code. The first step is to establish a connection to the SQL Server database. You can use the SqlConnection class in C# to create a connection string and connect to the database.

  10. How to Insert Data into a Database Using C# MVC

    Jul 24, 2024 · By following these steps, you can effectively insert data into a database using C# MVC. Remember to handle exceptions, validate user input, and ensure proper database connections for robust data insertion processes.

  11. Some results have been removed
Refresh