Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# insert into database

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.ExecuteNonQuery();
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get random file in directory c# 
Csharp :: email regex c# 
Csharp :: how to destroy in unity 
Csharp :: unity get gameobject script is attached to 
Csharp :: generate random number c# 
Csharp :: c# get wifi ip address 
Csharp :: swagger authentication bearer .net core 
Csharp :: get dropdown selected value unity 
Csharp :: c# empty char 
Csharp :: c# string to datetime 
Csharp :: c# System.Resources.MissingManifestResourceException error 
Csharp :: if get key down unity 
Csharp :: c# round to 2 decimal places 
Csharp :: how to set image Source in the code C# 
Csharp :: contains with ignore case c# 
Csharp :: assign datasource to dropdownlist in c# 
Csharp :: get string name of dropdown in unity 
Csharp :: how to usefor loop in c# 
Csharp :: unity3d quaternion add 90 degrees 
Csharp :: how to log out of unity asset store 
Csharp :: unity how to remove a tag 
Csharp :: unity how to rotate something to point to something else 
Csharp :: Codewars Multiply 
Csharp :: unity 3d sound 
Csharp :: .net hello world 
Csharp :: c# writteline 
Csharp :: unity knowing when 0 input is pressed 
Csharp :: unity dontdestroyonload 
Csharp :: how to get the path of the current directory in c# 
Csharp :: unity check load scene 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =