Click here to Skip to main content
15,907,493 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Exception: An object reference does not point to an instance of an objec Pin
Gary R. Wheeler2-Apr-22 3:21
Gary R. Wheeler2-Apr-22 3:21 
GeneralRe: C# Exception: An object reference does not point to an instance of an objec Pin
Pete O'Hanlon5-Apr-22 4:03
mvePete O'Hanlon5-Apr-22 4:03 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
Raphael Adeniji10-Apr-22 14:20
Raphael Adeniji10-Apr-22 14:20 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
Raphael Adeniji12-Apr-22 3:36
Raphael Adeniji12-Apr-22 3:36 
QuestionAccess Android Tablet from C# Pin
Kevin Marois30-Mar-22 18:23
professionalKevin Marois30-Mar-22 18:23 
AnswerRe: Access Android Tablet from C# Pin
Richard MacCutchan30-Mar-22 22:30
mveRichard MacCutchan30-Mar-22 22:30 
GeneralRe: Access Android Tablet from C# Pin
Kevin Marois31-Mar-22 6:15
professionalKevin Marois31-Mar-22 6:15 
GeneralRe: Access Android Tablet from C# Pin
Richard MacCutchan31-Mar-22 6:19
mveRichard MacCutchan31-Mar-22 6:19 
AnswerRe: Access Android Tablet from C# Pin
OriginalGriff31-Mar-22 3:09
mveOriginalGriff31-Mar-22 3:09 
GeneralRe: Access Android Tablet from C# Pin
Kevin Marois31-Mar-22 6:16
professionalKevin Marois31-Mar-22 6:16 
GeneralRe: Access Android Tablet from C# Pin
Kevin Marois31-Mar-22 8:11
professionalKevin Marois31-Mar-22 8:11 
GeneralRe: Access Android Tablet from C# Pin
OriginalGriff31-Mar-22 19:49
mveOriginalGriff31-Mar-22 19:49 
QuestionError when parsing string as int Pin
Member 1558328029-Mar-22 5:19
Member 1558328029-Mar-22 5:19 
AnswerRe: Error when parsing string as int Pin
Dave Kreskowiak29-Mar-22 5:33
mveDave Kreskowiak29-Mar-22 5:33 
QuestionFind the smallest integer that is not in a random array Pin
Member 1204230226-Mar-22 8:01
Member 1204230226-Mar-22 8:01 
AnswerRe: Find the smallest integer that is not in a random array Pin
OriginalGriff26-Mar-22 8:22
mveOriginalGriff26-Mar-22 8:22 
GeneralRe: Find the smallest integer that is not in a random array Pin
Member 1204230226-Mar-22 8:29
Member 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
Member 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
Member 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
N 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 

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.