Click here to Skip to main content
15,347,088 members
Home / Discussions / C#
   

C#

 
GeneralRe: Find the smallest integer that is not in a random array Pin
Member 1204230226-Mar-22 8:29
MemberMember 1204230226-Mar-22 8:29 
GeneralRe: Find the smallest integer that is not in a random array Pin
OriginalGriff26-Mar-22 8:46
mveOriginalGriff26-Mar-22 8:46 
GeneralRe: Find the smallest integer that is not in a random array Pin
Member 1204230226-Mar-22 9:51
MemberMember 1204230226-Mar-22 9:51 
GeneralRe: Find the smallest integer that is not in a random array Pin
OriginalGriff26-Mar-22 11:43
mveOriginalGriff26-Mar-22 11:43 
GeneralRe: Find the smallest integer that is not in a random array Pin
Member 1204230226-Mar-22 12:17
MemberMember 1204230226-Mar-22 12:17 
GeneralRe: Find the smallest integer that is not in a random array Pin
OriginalGriff26-Mar-22 20:05
mveOriginalGriff26-Mar-22 20:05 
AnswerRe: Find the smallest integer that is not in a random array Pin
Richard MacCutchan26-Mar-22 22:32
mveRichard MacCutchan26-Mar-22 22:32 
QuestionInserting Through Radionbutton and checkbox Pin
N Mohamed rafi25-Mar-22 23:20
MemberN Mohamed rafi25-Mar-22 23:20 
My insert code is not working fine, bcz if i click radionbutton2 and checkbox 2 means it was inserting data automatically radionbutton1 and checkbox1 only, actually if which textbox is selected that data should enter null value radionbutton data should not saved in db

if (!string.IsNullOrEmpty(textBox11.Text) && !string.IsNullOrEmpty(textBox12.Text) && !string.IsNullOrEmpty(textBox13.Text) && !string.IsNullOrEmpty(textBox14.Text) && (radioButton1.Checked || radioButton2.Checked) && (checkBox1.Checked || checkBox2.Checked))
            {
                string connectionString;
                MySqlConnection cnn;
                connectionString = @"Data Source=localhost;Initial Catalog=testDB;User ID=root;Password=mysql";
                cnn = new MySqlConnection(connectionString);
                cnn.Open();
                string id = textBox14.Text;
                string name = textBox11.Text;
                string year = textBox12.Text;
                string quality = radioButton1.Text == "" ? radioButton2.Text : radioButton1.Text;
                string taste = checkBox1.Text == "" ? checkBox2.Text : checkBox1.Text;
                string sales = textBox13.Text;
                textBox11.Text = "";
                textBox12.Text = "";
                textBox13.Text = "";
                textBox14.Text = "";
                radioButton1.Text = "";
                radioButton2.Text = "";
                checkBox1.Text = "";
                checkBox2.Text = "";
                string query = "INSERT INTO fruits VALUES(@fruitsid, @fruitsname, @fruitsyear, @quality, @taste, @sales)";
                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Parameters.AddWithValue("@fruitsid", Convert.ToInt32(id));
                    cmd.Parameters.AddWithValue("@fruitsname", name);
                    cmd.Parameters.AddWithValue("@fruitsyear", year);
                    cmd.Parameters.AddWithValue("@quality", quality);
                    cmd.Parameters.AddWithValue("@taste", taste);
                    cmd.Parameters.AddWithValue("@sales", sales);
                    cmd.Connection = cnn;
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Record Inserted Successfully");
                    DisplayData();
                    cnn.Close();
                }
            }
            else
            {
                MessageBox.Show("Please Fill Data");
            }
AnswerRe: Inserting Through Radionbutton and checkbox Pin
OriginalGriff25-Mar-22 23:55
mveOriginalGriff25-Mar-22 23:55 
AnswerRe: Inserting Through Radionbutton and checkbox Pin
Richard MacCutchan26-Mar-22 0:19
mveRichard MacCutchan26-Mar-22 0:19 
GeneralRe: Inserting Through Radionbutton and checkbox Pin
Luc Pattyn26-Mar-22 9:24
sitebuilderLuc Pattyn26-Mar-22 9:24 
AnswerRe: Inserting Through Radionbutton and checkbox Pin
Craig Robbins26-Mar-22 3:36
MemberCraig Robbins26-Mar-22 3:36 
GeneralRe: Inserting Through Radionbutton and checkbox Pin
N Mohamed rafi26-Mar-22 5:16
MemberN Mohamed rafi26-Mar-22 5:16 
GeneralRe: Inserting Through Radionbutton and checkbox Pin
Craig Robbins26-Mar-22 12:42
MemberCraig Robbins26-Mar-22 12:42 
Questionhow get dpi scale factor Pin
Le@rner22-Mar-22 21:29
MemberLe@rner22-Mar-22 21:29 
AnswerRe: how get dpi scale factor Pin
Victor Nijegorodov22-Mar-22 22:28
MemberVictor Nijegorodov22-Mar-22 22:28 
AnswerRe: how get dpi scale factor Pin
Richard MacCutchan22-Mar-22 22:36
mveRichard MacCutchan22-Mar-22 22:36 
GeneralRe: how get dpi scale factor Pin
Le@rner22-Mar-22 23:16
MemberLe@rner22-Mar-22 23:16 
GeneralRe: how get dpi scale factor Pin
Richard MacCutchan22-Mar-22 23:19
mveRichard MacCutchan22-Mar-22 23:19 
GeneralRe: how get dpi scale factor Pin
Le@rner22-Mar-22 23:20
MemberLe@rner22-Mar-22 23:20 
GeneralRe: how get dpi scale factor Pin
Richard MacCutchan22-Mar-22 23:30
mveRichard MacCutchan22-Mar-22 23:30 
GeneralRe: how get dpi scale factor Pin
Le@rner23-Mar-22 0:00
MemberLe@rner23-Mar-22 0:00 
GeneralRe: how get dpi scale factor Pin
Richard MacCutchan23-Mar-22 0:23
mveRichard MacCutchan23-Mar-22 0:23 
GeneralRe: how get dpi scale factor Pin
Dave Kreskowiak23-Mar-22 2:49
mveDave Kreskowiak23-Mar-22 2:49 
GeneralRe: how get dpi scale factor Pin
Le@rner23-Mar-22 17:55
MemberLe@rner23-Mar-22 17:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.