Update DataGrid
-
I kow it,I do it like this: oleDbCommand1.Connection.Open(); oleDbCommand1.ExecuteNonQuery(); oleDbDataAdapter1.Update(dataSet11,"Table2"); dataGrid1.DataSource=dataSet11.Tables["Table2"]; ???Binding???????? Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975In WinForms I found all I had to do was assign to the DataSource property as you have done; I think in ASP.NET you do that and you have to call
dataGrid1.DataBind();
. Any closer? James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978 -
In WinForms I found all I had to do was assign to the DataSource property as you have done; I think in ASP.NET you do that and you have to call
dataGrid1.DataBind();
. Any closer? James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978James T. Johnson wrote: dataGrid1.DataBind();. I'm aware of that in ASP.Net,but it does not exist in windows form:( James T. Johnson wrote: In WinForms I found all I had to do was assign to the DataSource property as you have done; You mean you set the datasource of datagrind without any databinding,and datagrid reflect the changes ?:confused: Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
Mazdak wrote: oleDbCommand1.Connection.Open(); oleDbCommand1.ExecuteNonQuery(); oleDbDataAdapter1.Update(dataSet11,"Table2"); dataGrid1.DataSource=dataSet11.Tables["Table2"]; dataGrid1.DataBind();
-
James T. Johnson wrote: dataGrid1.DataBind();. I'm aware of that in ASP.Net,but it does not exist in windows form:( James T. Johnson wrote: In WinForms I found all I had to do was assign to the DataSource property as you have done; You mean you set the datasource of datagrind without any databinding,and datagrid reflect the changes ?:confused: Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Mazdak wrote: You mean you set the datasource of datagrind without any databinding,and datagrid reflect the changes I'll have to see if i can find my test code; but I don't recall doing anything more than what you have done. James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
Andy Smith wrote: dataGrid1.DataBind(); That does not exist in WinForms:( Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975oh, oops sorry, i'm a webguy, and I just kind of assumed... um, From my vb6 days... I seem to remember setting the datasource to nothing and then setting it again... so try something like this: dataGrid1.DataSource = null; dataGrid1.DataSource = myDataSourceExpression;
-
James T. Johnson wrote: dataGrid1.DataBind();. I'm aware of that in ASP.Net,but it does not exist in windows form:( James T. Johnson wrote: In WinForms I found all I had to do was assign to the DataSource property as you have done; You mean you set the datasource of datagrind without any databinding,and datagrid reflect the changes ?:confused: Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975I've uploaded a quick sample I did; by all means do not look at it as the proper way to deal with user created dialogs or naming conventions (i stuck with defaults for names, and the dialog is handled oddly since i wanted to require both username/password and didn't look up the "proper" way of doing that). I've included the compiled executable so you don't have to try monkeying around with the VS.NET generated .resx's :) http://www.takklesoft.com/dotnet/DataGridTestApp.zip James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
I've uploaded a quick sample I did; by all means do not look at it as the proper way to deal with user created dialogs or naming conventions (i stuck with defaults for names, and the dialog is handled oddly since i wanted to require both username/password and didn't look up the "proper" way of doing that). I've included the compiled executable so you don't have to try monkeying around with the VS.NET generated .resx's :) http://www.takklesoft.com/dotnet/DataGridTestApp.zip James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
Really thanks James,You are always big help.:rose: Now I can add recoeds to database and show it in DataGrid too but I have a question about it: In Visual C++ when I add a record to a database the DataGrid reflect it by using only
Refresh()
method,But here in .NET I have to create new Row dynamicly for DataGrid and do it seprately from the new record in DataSource(Here when I say DataSource I mean my Access file not DataSet),Is that right or other way exists too? I think I mess up thinks in VC++ and C# ;) Thanks :) Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
Really thanks James,You are always big help.:rose: Now I can add recoeds to database and show it in DataGrid too but I have a question about it: In Visual C++ when I add a record to a database the DataGrid reflect it by using only
Refresh()
method,But here in .NET I have to create new Row dynamicly for DataGrid and do it seprately from the new record in DataSource(Here when I say DataSource I mean my Access file not DataSet),Is that right or other way exists too? I think I mess up thinks in VC++ and C# ;) Thanks :) Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Mazdak wrote: Is that right or other way exists too? I haven't delved too deep into data binding yet, soon as i get the crummy design phase done though I'll be diving into it head first :) But from what I can tell if you update the data source without going through the underlying dataset/table, then you have to go about it as you are now. If you make your changes through the DataSet (and the underlying DataTables) then you can just call Update on the *DataAdapter to have the changes reflected back to the data source. Mazdak wrote: Really thanks James,You are always big help. :rose: Awwwww shucks :-O :laugh: James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
Mazdak wrote: Is that right or other way exists too? I haven't delved too deep into data binding yet, soon as i get the crummy design phase done though I'll be diving into it head first :) But from what I can tell if you update the data source without going through the underlying dataset/table, then you have to go about it as you are now. If you make your changes through the DataSet (and the underlying DataTables) then you can just call Update on the *DataAdapter to have the changes reflected back to the data source. Mazdak wrote: Really thanks James,You are always big help. :rose: Awwwww shucks :-O :laugh: James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
Here you talk in simple words,I understand them. ;) Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975My intention is never to confuse anyone, but at times it sounds like English isn't my native language :( I have no idea why that is, I know the rules for grammar structure and what not but my thoughts always come out jumbled around so i have to try to piece them together the correct way. James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978