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 :: .net 6 foreach only if not null 
Csharp :: select vs where linq 
Csharp :: c# crud observablecollection -mvvm 
Csharp :: unity run all interfaces 
Csharp :: change character velocity unity 
Csharp :: C# Blocks without statements 
Csharp :: in model add to give drop down message 
Csharp :: DotNet web Api Token based Authentication 
Csharp :: c# for loop Statement 
Csharp :: Stop Unity Wait Time with Button 
Csharp :: webtest fullscreen extend window maximize 
Csharp :: REMOVE BOTTOM TAB XAMARIN FORMS 
Csharp :: wpf create rectangle c# 
Csharp :: object shaking unity 
Csharp :: most popular products code using asp.net core in visual studio code 
Csharp :: how to create more accurate searching c# 
Csharp :: set data annotation in model c# 
Csharp :: c# razor @html.actionlink( edit bootstrap 
Csharp :: grass download for unityh 
Csharp :: method declaration in c# 
Csharp :: c# url relative path remove 
Csharp :: c# office interop copy slide to another pppt 
Csharp :: c# stack 
Csharp :: c# return default "" if null 
Csharp :: listview android studio java 
Csharp :: c# String Uppercase and Lowercase method 
Csharp :: deserialize list of objects c# 
Csharp :: run as administrator vs 2019 
Csharp :: width="331" height="331" 
Csharp :: cancellationtoken.linkedtokensource c# example 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =