Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

save checkbox value to database c#

bool valorGuardar = CheckBox.Checked // Checked property will
return boolean value -- true or false
Comment

how to save checkbox value in database in c#

SqlCommand Command = new SqlCommand();
                Command.Connection = MyConnection;
                Command.CommandText =
                    "Insert into Employees (ID, Name, Last_name, Username, Password, E_mail, Address, administrator_rights)"
                    + "values(@ID, @Name, @Last_name, @Username, @Password, @E_mail,Address, @admin_rights )";

            Command.Parameters.Add("@ID", 1); // some generated number
            Command.Parameters.Add("@Name", TextBoxName.Text);
            Command.Parameters.Add("@Last_name", TextBoxLastName.Text);
            Command.Parameters.Add("@Username", TextBoxUserName.Text);
            Command.Parameters.Add("@Password", TextBoxPassword.Text);
            Command.Parameters.Add("@E_mail", TextBoxEmail.Text);
            Command.Parameters.Add("@Address", TextBoxAddress.Text);
            Command.Parameters.Add("@admin_rights", CheckBoxAdminRights.Checked);

            using (MyConnection)
            {
                Command.ExecuteNonQuery();
            }
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to handle list properties in c# of string type 
Csharp :: how to authorize token when consuming api in c# 
Csharp :: unity shader show object behind object 
Csharp :: one to many relationship in asp net entity framework with role 
Csharp :: how to coppy a portion of an array in c# 
Csharp :: C# verify "no other" call xunit 
Csharp :: Nested objects with linq expression 
Csharp :: game creator change local variable 
Csharp :: FileSystemEventHandler raised twice 
Csharp :: how to get the size of an array in c# 
Csharp :: custom vscode snippet 
Csharp :: integer to boolean conversion in unity C# 
Csharp :: javas 
Csharp :: unity c# request store review 
Csharp :: assetfinder 
Csharp :: c# second last index 
Csharp :: convert string to int tryparse c# 
Csharp :: MailChimp C# Api calls 
Csharp :: C# a program to reverse each word in the given string. 
Csharp :: polling data source c# using threads 
Html :: html meta redirect 
Html :: html starter code 
Html :: center text v-card 
Html :: open vsc with admin rights linux 
Html :: bootstrap circle button 
Html :: box shadow svg css 
Html :: viewport meta tags 
Html :: html change viewport to smartphone size 
Html :: bootstrap height 100vh class 
Html :: auto update copyright year html 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =