|
Hi,
I'm new to the windows datagrid control. I'm trying to create an application that displays the contents on an access database. I've got that part working so far; my question is how can I have the datagrid & access database accept any changes that the user enters into the datagrid. Is their a way for the datagrid's contents to be dumped into the access database after a change is made? I don't want to do it manually, it could get messy.
Thanks
|
|
|
|
|
You have to take look at htese class:
Use a OleDbDataADapter to fill a DataSet and bind it to DataGrid , then each change reflected to datagrid, you can update access database with OleDBdDataAdapter.Update() method. If you search for these classes you can find samples in this site and MSDN.
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Hi Mazy,
I have a datagrid in win form that when a change to a record on that same form occurs how can I get the datagrid to refresh with new updates?
I have the datagrid bound to a dataview. So some how need way to update the dataview I'm guessing.
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
I have the datagrid bound to a dataview. So some how need way to update the dataview I'm
I told you how to do this. The dataview only for VIEW, you bind it to datagrid and when something change in datagrid it reflected in dataview automaticly.
MrJJKoolJ wrote:
can I get the datagrid to refresh with new updates?
You don't need to do that, as I told you , yu made change in DataSet, then it AUTOMATICLLY it is reflected in your datagrid.
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Thats my problem Mazy, I change some field that isn't in grid but on same form and it isn't bound. But it updates the same dataset. I click on Update button and changes to db are updated but grid doesn't update at all. I even tried refreshing grid to no avail !
JJ
|
|
|
|
|
The nature of daragrid is for binding to dataset and other than that is nor very well scenario. But if you want to update datagrid independently, you can do it like this:
datagrid[rowindex,columnindex] = value;
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Mazy,
Your not understanding me. The datagrid is bound to dataview but a field outside of the datagrid isn't bound. I want to be able to put value into that field which updates the same dataset that the datagrid is attached to. So maybe my problem is I should be binding the fields outside of datagrid to same dataset? What do u think?
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
The datagrid is bound to dataview but a field outside of the datagrid isn't bound
Yes,I really don't understand, no matter, forget it.
MrJJKoolJ wrote:
What do u think?
Its hard to say when I don't know your desin and requierment but the general rule that I always follow is, do not seprerate the datagrid from dataset and from other things that related to database. I bind everything that refer to database to dataview or dataset, then everythings work together so it prevent dirty code. thats all I can tell you.
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
See Mazy, I not one to bind to controls because I'm afraid of taking a proformance hit and doesn't it start to bloat the app if you bind?
Or has this gotten alot better since using VS 6?
Thanks,
JJ
|
|
|
|
|
Well don't think it cause a lot performance hit but I can't say for sure as long as I don't know anything about your codes and logic.
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Hi,
Ok using Typed Datasets and using a table in that dataset that I am working on.
What do I use in order to find a particular row and be able to update db with row changes? Do I use a dataview thats tied to datatable and have it find it that way or is their something else in order to find a particular row?
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
Do I use a dataview thats tied to datatable and have it find it that way or is their something else in order to find a particular row?
You could. The point is you need to qualify the row somehow, which is usually done by an ID or by having the user select that row in a list, in which case the row is a simple numeric index.
Without understanding the context of what you are asking, it's hard to be more specific--for example, my question to you is, what information are you looking for in the dataset that makes you *need* to search for a row? With the DataView, you can use the RowFilter to qualify the DataSet, or you could have the query already formed with the appropriate "where" clause, or you could have an "update" SQL statement yourself with the appropriate "where" clause. Different answers for different situations.
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
With data binding, you don't even need to know what row because it's managed for you. Look at DataView.RowStateFilter as an example to view the data that's been modified.
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
MrJJKoolJ wrote:
What do I use in order to find a particular row and be able to update db with row changes?
If you want ONE row you can get it with Find() method of your DataSet, if it could be more than one row use Select() method. FinD method return a DataRow which you can change each column like this:
datarow["columnname"] = value;
and then call the Update() method of DataAdapter. Thats it, you do not need DataView cause it filter your table.
[EDITED]
This is the place of Find and Select methods:
DataSet.Tables[index].Rows.Find()/Select()
[/EDITED]
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Thank you for your response guys.
I am using a dataset and needed to find a particular *one* Row.
And I was looking for the best way to go about it. I create a dataadapter with Typed dataset that brings back multiple recs.
Now with that scenario, I am trying to find a particular row to update in dataset. I do have the row Identified by a key and I don't want to create another dataadapter and dataset to get just the one row. So I need to find out the position of rec in dataset
so that I can update it. Make sense now? I think that Mazy's way sounds good. Use the find method.
Thanks Again,
JJ
|
|
|
|
|
Hi friends,
I am involved in project whose the development of base classes and architecture high level were under my team responsibility. After creating 80% of these
classes I am about to involve more developers in the process and I fall in problem that is me leaving a little preoccupied: These basic components won't be maintained
by production team and they will only have access to the binaries of these components.
The tools that I made some tests for assemblies obfuscation it doesn't allow me to protect such assemblies inside the team. I would like that the team have these assemblies
ALREADY protected, what would be the first level of safety against copy of intellectual property. My idea is that even if talented programmer gets to leave of company with the
sources that contain the business rules, the CORE it (basic classes, personalized controls, access rules for database and etc) of the thing he won't have access,
which, I belive, turns the sources "less attractive" because to create such components
of the zero it would take plenty time.
Does anybody already use some tool that allows something like that?
Does anybody have some idea on this?
Greetings,
Marcelo Palladino
Brazil
|
|
|
|
|
Palladino wrote:
I would like that the team have these assemblies ALREADY protected, what would be the first level of safety against copy of intellectual property. My idea is that even if talented programmer gets to leave of company with the sources that contain the business rules, the CORE it (basic classes, personalized controls, access rules for database and etc) of the thing he won't have access, which, I belive, turns the sources "less attractive" because to create such components of the zero it would take plenty time.
1. You need to trust your team.
2. You are making the assumption that someone will act unethically at best, and illegally at worst. Another company hiring such a person, at least here in the US, can get in real hot water. There are employee agreements to prevent this, including the jokingly unenforceable "you can't work in a related industry for 5 years after termination" type of BS.
3. Is this something you really feel is necesary to spend time and effort worrying about?
Palladino wrote:
Does anybody have some idea on this?
It wasn't clear as to why you can't give the production team the obfuscated assemblies. How is obfuscation failing you in this instance?
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
Hi Marc,
Before anything: Thank you for trying to understand me. I am aware that my English is badly, I am trying to get better.
Marc Clifton wrote:
3. Is this something you really feel is necesary to spend time and effort worrying about?
hum... To read your post made to think me of another point of view. Perhaps it is not, really... I will continue thinking about this.
Marc Clifton wrote:
It wasn't clear as to why you can't give the production team the obfuscated assemblies. How is obfuscation failing you in this instance?
I have like this a class (before obfuscation):
public class MyClass
{
}
After obfuscation:
public class 983276376jssdjh
{
}
Perhaps I am making something wrong, but this way, the assemblie becomes invalid for programming. The execution goes well, however.
Hugs,
Marcelo Palladino
Brazil
|
|
|
|
|
Palladino wrote:
Perhaps I am making something wrong, but this way, the assemblie becomes invalid for programming. The execution goes well, however.
Ah, you so you want the source code obfuscated?
It would be a little bit of work to add the automation, but what would happen if you took your obfuscated assembly, read it into Lutz Roeder's .NET Refelctor[^], and ran the "decompiler" function to emit the now obfuscated but still compileable assembly source?
But I'm confused about something--why supply the source and obfuscate things like the class name? Wouldn't that break other functions that reference that class? Or do you *want* people to use the obfuscated source?
No wait--you want to supply the internal source obfuscated, but there are certain "public" unobfuscated classes and methods that are the interface points? Is that it?
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
Hi again Marc,
Marc Clifton wrote:
No wait--you want to supply the internal source obfuscated, but there are certain "public" unobfuscated classes and methods that are the interface points? Is that it?
It is exactly this! What is happening, with the tool that I am using: It is changing the names of the types, instead of changing implementation only.
However, when beginning to talk with you I went to test other tools (Salamander, for instance) and I noticed that work in the expected way.
It seems that am in the road. Thank you, again!
Marcelo Palladino
Brazil
|
|
|
|
|
Hi again, Marc!
Now I have the clearest subject in my mind. I want assemblies obsfucation but it would like the names of the members not to be altered by this process. That is possible?
Sincerely,
Marcelo Palladino
Brazil
|
|
|
|
|
Hey
If you have a .NET remote server and a client seperated by an shared assembly, is it the possible to test the connection.
I want to test the connection to the server to see if it is running before executing any of my remote methods on it.
When I'm using RemotingServices.Connect I will never get null in return, when using a shared assembly. I have also tried using Activator.GetObject, no luck.
Is there any way to see if there is a running server in the other end before executing methods?
|
|
|
|
|
I just read yesterday something about that the proxy won't actually finish the process of connecting to the server and loading the shared assembly until you actually reference it in a method call.
For example, I can create the channel, register it, and use Activator.GetObject without a single problem. Only when I make the function call do I get the following exception:
"No connection could be made because the target machine actively refused it"
So, maybe you can have a dummy "Test" method that you call and catch an exception on?
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
Hi all,
I wrote a multi-thread application using sockets. But when i attempt to stop a thread, the thread is falling into "AbortRequested" state but never being aborted. Can anyone help me?
My code is below:
if ( this.m_ReceiveThread.IsAlive )
MessageBox.Show( "alive" );
MessageBox.Show( "State: " + this.m_ReceiveThread.ThreadState.ToString() );
if ( this.m_ReceiveThread != null )
{
for ( int i = 0; i <= 10; i++ )
{
try
{
this.m_ReceiveThread.Abort();
this.m_ReceiveThread.Join( 100 );
/*
!!!!!! it always says current state is AbortRequested !!!!!!
*/
MessageBox.Show( "m_ReceiveThread trying to abort. - " + i.ToString()
+ "\nCurrentState: " + this.m_ReceiveThead.ThreadState.ToString() );
}//End of try.
catch
{
}//End of catch.
if ( this.m_ReceiveThread.ThreadState == ThreadState.Aborted
|| this.m_ReceiveThread.ThreadState == ThreadState.Stopped )
{
MessageBox.Show( "m_ReceiveThread aborted." );
break;
}//End of if ( this.m_ReceiveThread.ThreadState == ThreadState.Aborted ).
}//End of for( int i = 0; i <= 10; i++ ).
}// End of if ( this.m_ReceiveThread != null ).
|
|
|
|
|
Thread.Abort:
Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.
I like the word "usually".
Look at the example in MSDN. Are you catching all exceptions in the thread and not properly handling ThreadAbortException?
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|