Click here to Skip to main content
15,907,236 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to update a table called title_edit,
I created 3 update queries with the designer,
now when I execute the update query in the Designer for testing,the table gets updated without p;roblems
but when I try to update it from the Form it fails to update

I have 3 multidimensional arrays & 3 comboboxes,
the comboboxes are binned with the strings in the first column and I want to save the strings from the second column to the table


C#
private void button1_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.title_editBindingSource.EndEdit();
            if (comboBox1.SelectedIndex > 0) this.title_editTableAdapter.Updatefontsize(size[1,comboBox1.SelectedIndex]); 
            if (comboBox2.SelectedIndex > 0)  this.title_editTableAdapter.Updatefontcolor(color[1, comboBox2.SelectedIndex]);
            if (comboBox3.SelectedIndex > 0)  this.title_editTableAdapter.Updatefontfamily(font[1, comboBox3.SelectedIndex]);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.title_editBindingSource.EndEdit();
            this.title_editTableAdapter.Updatefontsize(size[1, 3]);
            this.title_editTableAdapter.Updatefontcolor("#000000");
            this.title_editTableAdapter.Updatefontfamily("arial,helvetica,sans-serif");
           
            MessageBox.Show("Loaded Default Settings");
        }


both buttons dont do anything

the queries looks like this one:

SQL
UPDATE       title_edit
SET                fontfamily = @p3
WHERE        (id = 1)


Im using VS2010
Posted
Updated 10-Nov-11 13:13pm
v3

Inspect your rows to see if there are errors after the update.

More on that here.[^]

Also, you said it's not working...are you getting an exception? If so, be sure to post some details.

Cheers.
 
Share this answer
 
Comments
Prince_ 11-Nov-11 8:48am    
No Errors and No Exceptions,
Nothing Happens after I click the button, :(
Prince_ 11-Nov-11 9:02am    
Like I said I can Update the table in the Dataset Designer but not in the form
where did you define @p3 parameter?
first declare @p3 parameter and set vale to it. then execute it.
 
Share this answer
 
Comments
Prince_ 13-Nov-11 11:57am    
@p3 comes from the Designer, I wrote the Query in the Designer,
in the code of the Form I then just write :
this.title_editTableAdapter.Updatefontfamily("arial,helvetica,sans-serif");
and it should automaticly accept "arial,helvetica,sans-serif" as the @p3 String,

I have other tables in the same DB and Dataset which work fine,
I also put the modifiers to Public but nothing happenend.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900