Somehow that fix doesn't seem to fit your scenario. I suspect you've
still got an issue lurking. I'd wrap that resource in a mutex.

∞ Andy Badera
∞ This email is: [ ] bloggable [x] ask first [ ] private
∞ Google me: http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)



On Tue, Sep 1, 2009 at 3:24 AM, VIKAS GARG<vikas200002...@gmail.com> wrote:
>
> My code is working now.
> there was not any problem with my code.
> The problem was in mySql table.
> "S.No." was defined as a primary key there.
> and acc to MySql sytax we can't use "." in defining attribute name.
> I only changed "S.No." to SNo and worked
> With Regards
> Vikas Garg
>
> On 9/1/09, Arsalan Tamiz <sallus...@gmail.com> wrote:
>> Also I think "dgView_Validating" event handler is NOT a good choice to send
>> updates.
>>
>> On Mon, Aug 31, 2009 at 3:03 AM, VIKAS GARG <vikas200002...@gmail.com>wrote:
>>
>>> I am working on an application in which I am fetching data from databse
>>> and
>>> showing in datagrid.When I am trying to add new row the code is working
>>> well
>>> but when I wm trying to modify any existing row than it is throwing
>>> OdbcException I am using DataAdapter in my application. For reference I am
>>> attaching the code....
>>>  public partial class Form1 : Form
>>>   {
>>>   OdbcDataAdapter dAdapter;
>>>   DataTable dTable;
>>>   BindingSource bSource;
>>>   public Form1()
>>>   {
>>>   InitializeComponent();
>>>   }
>>>
>>>   private void Form1_Load(object sender, EventArgs e)
>>>   {
>>>   string connString = "DRIVER={MySQL ODBC 5.1 Driver};" +
>>>   "SERVER=127.0.0.1;PORT=3306;DATABASE=test;" +
>>>   "UID=root;PWD=vikas;OPTION=3";
>>>   string query = "select * from newproduct";
>>>   dAdapter = new OdbcDataAdapter(query, connString);
>>>   OdbcCommandBuilder cBuilder = new OdbcCommandBuilder(dAdapter);
>>>   dTable = new DataTable();
>>>   dAdapter.Fill(dTable);
>>>   //DataGridView dgView = new DataGridView();
>>>   bSource = new BindingSource();
>>>   bSource.DataSource = dTable;
>>>   dgView.DataSource = bSource;
>>>   }
>>>
>>>   private void dgView_Validating(object sender, CancelEventArgs e)
>>>   {
>>>   //try
>>>   //{
>>>   bSource.EndEdit();
>>>   dAdapter.Update(dTable);
>>>   //}
>>>   //catch { }
>>>   }
>>>
>>>   private void Exbut_Click(object sender, EventArgs e)
>>>   {
>>>   Close();
>>>   }
>>>   }
>>>
>>>
>>
>

Reply via email to