Click here to Skip to main content
14,303,069 members
   

C#

 
GeneralRe: c# app design Pin
Richard Andrew x6427-Jul-19 3:21
professionalRichard Andrew x6427-Jul-19 3:21 
QuestionCrystel Report in Print Duplicate Page Print Pin
Member 1235167123-Jul-19 0:53
memberMember 1235167123-Jul-19 0:53 
RantRe: Crystel Report in Print Duplicate Page Print Pin
Richard Deeming23-Jul-19 1:00
mveRichard Deeming23-Jul-19 1:00 
AnswerRe: Crystel Report in Print Duplicate Page Print Pin
OriginalGriff23-Jul-19 4:01
protectorOriginalGriff23-Jul-19 4:01 
AnswerRe: Crystel Report in Print Duplicate Page Print Pin
Gerry Schmitz24-Jul-19 6:22
mveGerry Schmitz24-Jul-19 6:22 
QuestionData type mismatch in update query Pin
Member 1326108423-Jul-19 0:07
memberMember 1326108423-Jul-19 0:07 
QuestionRe: Data type mismatch in update query Pin
Eddy Vluggen23-Jul-19 0:50
mveEddy Vluggen23-Jul-19 0:50 
AnswerRe: Data type mismatch in update query Pin
Member 1326108423-Jul-19 1:54
memberMember 1326108423-Jul-19 1:54 
Hi
I use this code to add the values to the parameters.

cmd.Parameters.AddWithValue("@n", this.Name_textBox.Text);
                    cmd.Parameters.AddWithValue("@a", this.Address_textBox.Text);
                    cmd.Parameters.AddWithValue("@p", this.Phone_textBox.Text);
                    cmd.Parameters.AddWithValue("@em", this.Email_textBox.Text);
                    cmd.Parameters.AddWithValue("@d", this.Date_textBox.Text);
                    cmd.Parameters.Add(new OleDbParameter("@don", OleDbType.Boolean));
                    cmd.Parameters.Add(new OleDbParameter("@r", OleDbType.Boolean));
                    cmd.Parameters.Add(new OleDbParameter("@war", OleDbType.Boolean));
                    cmd.Parameters.AddWithValue("@IT", this.Type_comboBox.Text);
                    cmd.Parameters.AddWithValue("@m", this.Make_textBox.Text);
                    cmd.Parameters.AddWithValue("@MO", this.Model_textBox.Text);
                    cmd.Parameters.AddWithValue("@s", this.Serial_textBox.Text);
                    cmd.Parameters.AddWithValue("@RF", this.ReportedFault_textBox.Text);
                    cmd.Parameters.AddWithValue("@i", this.RepairedBy_textBox.Text);
                    cmd.Parameters.AddWithValue("@FT", this.FaultType_comboBox.Text);
                    cmd.Parameters.Add(new OleDbParameter("@Rep", OleDbType.Boolean));
                    cmd.Parameters.Add(new OleDbParameter("@BER", OleDbType.Boolean));
                    cmd.Parameters.AddWithValue("@FF", this.FaultFound_textBox.Text);
                    if (DateTested_textBox.Text != "")
                    {
                        cmd.Parameters.AddWithValue("@DT", this.DateTested_textBox.Text);
                        cmd.Parameters.AddWithValue("@DueD", this.DueDate_textBox.Text);
                        cmd.Parameters.AddWithValue("@TestedBy", this.TestedBy_textBox.Text);
                        cmd.Parameters.Add(new OleDbParameter("@CPass", OleDbType.Boolean));
                        cmd.Parameters.AddWithValue("@CR", this.Conductor_textBox.Text);
                        cmd.Parameters.Add(new OleDbParameter("@InRes", OleDbType.Boolean));
                        cmd.Parameters.AddWithValue("@IR", this.Insulator_textBox.Text);
                        cmd.Parameters.Add(new OleDbParameter("@EarthL", OleDbType.Boolean));
                        cmd.Parameters.AddWithValue("@ER", this.Earth_textBox.Text);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@DT", "");
                        cmd.Parameters.AddWithValue("@DueD", "");
                        cmd.Parameters.AddWithValue("@TestedBy", "");
                        cmd.Parameters.AddWithValue("@CPass", false);
                        cmd.Parameters.AddWithValue("@CR", "");
                        cmd.Parameters.AddWithValue("@InRes", false);
                        cmd.Parameters.AddWithValue("@IR", "");
                        cmd.Parameters.AddWithValue("@EarthL", false);
                        cmd.Parameters.AddWithValue("@ER", "");
                    }


I have changed the checkbox lines from
cmd.Parameter.AddWithValue("@r, this.Repair_checkbox.checked);
to
cmd.Parameters.Add(new OleDbParameter("@r", OleDbType.Boolean));


The Bool variable r gets it's value with the line
bool r = Repair_checkBox.Checked;


However changing the line gives me an error saying "Failed Due to Parameter r has no default value"
The only checkbox line before the r variable is don and the corresponding checkbox is ticked, which is why I think it doesn't error.

I am only learning C# so the database will never be used. Therefore I am concentrating on getting it working rather than security, Which to me would make it even harder to understand.
GeneralRe: Data type mismatch in update query Pin
Eddy Vluggen23-Jul-19 2:40
mveEddy Vluggen23-Jul-19 2:40 
GeneralRe: Data type mismatch in update query Pin
Member 1326108423-Jul-19 2:55
memberMember 1326108423-Jul-19 2:55 
GeneralRe: Data type mismatch in update query Pin
Eddy Vluggen23-Jul-19 3:00
mveEddy Vluggen23-Jul-19 3:00 
GeneralRe: Data type mismatch in update query Pin
Member 1326108423-Jul-19 3:31
memberMember 1326108423-Jul-19 3:31 
GeneralRe: Data type mismatch in update query Pin
Eddy Vluggen23-Jul-19 6:05
mveEddy Vluggen23-Jul-19 6:05 
GeneralRe: Data type mismatch in update query Pin
Member 1326108423-Jul-19 7:09
memberMember 1326108423-Jul-19 7:09 
GeneralRe: Data type mismatch in update query Pin
Member 1326108423-Jul-19 7:48
memberMember 1326108423-Jul-19 7:48 
GeneralRe: Data type mismatch in update query Pin
Eddy Vluggen24-Jul-19 0:10
mveEddy Vluggen24-Jul-19 0:10 
AnswerRe: Data type mismatch in update query Pin
Luc Pattyn23-Jul-19 7:44
professionalLuc Pattyn23-Jul-19 7:44 
QuestionThis is a style question regarding partial classes Pin
honey the codewitch20-Jul-19 10:40
memberhoney the codewitch20-Jul-19 10:40 
AnswerRe: This is a style question regarding partial classes Pin
BillWoodruff20-Jul-19 11:04
mveBillWoodruff20-Jul-19 11:04 
GeneralRe: This is a style question regarding partial classes Pin
honey the codewitch20-Jul-19 11:07
memberhoney the codewitch20-Jul-19 11:07 
GeneralRe: This is a style question regarding partial classes Pin
BillWoodruff20-Jul-19 17:53
mveBillWoodruff20-Jul-19 17:53 
GeneralRe: This is a style question regarding partial classes Pin
honey the codewitch20-Jul-19 18:10
memberhoney the codewitch20-Jul-19 18:10 
GeneralRe: This is a style question regarding partial classes Pin
#realJSOP21-Jul-19 3:35
mve#realJSOP21-Jul-19 3:35 
AnswerRe: This is a style question regarding partial classes Pin
Bernhard Hiller21-Jul-19 20:54
memberBernhard Hiller21-Jul-19 20:54 
GeneralRe: This is a style question regarding partial classes Pin
honey the codewitch21-Jul-19 21:05
memberhoney the codewitch21-Jul-19 21:05 

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.