|
|
leppie wrote:
I very much doubt that.
I have a question in this regard.
What's the future for companies like NuMega (Bounds Checker) in the .NET world?
"...if you don't want to hear things that piss you off don't piss off other people. SIMPLE." - Steven Hicks This signature was created by "Code Project Quoter".
|
|
|
|
|
Kant wrote:
What's the future for companies like NuMega (Bounds Checker) in the .NET world?
Maybe like this[^]
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
Kant wrote:
What's the future for companies like NuMega (Bounds Checker) in the .NET world?
Maybe products that ensure that scarce resources are disposed of properly. Stuff like GDI+ objects, DB connections, Files, etc. All could possibly impact system performance if not handled correctly.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
i have a treeview control with about 20 subnodes. each time i click on a new node, a related form opens in the parent window. how can i close the currently opened form once a new node is selected in the treeview control?
thanks for your help.
|
|
|
|
|
First you will need to grab a reference to the parent window and the active window. Then you can close the active window. What I did was set a reference to the parent window in a var. Then I was able to call the variable and get the ActiveMdiChild property and set that property to close. So I have something like this
if (parent.ActiveMdiChild != null)
{
parent.ActiveMdiChild.Close();
}
|
|
|
|
|
thank you for your help. it worked exactly like you said.
|
|
|
|
|
Below is the code I am trying to use. I am trying to update a row in the datatable. The test2 just points at which row it should update. The error I get tells me I am trying to create a duplicate key. I understand that, but I cant figure out anyother way to update the database. On other tests, the dataTable updates perfectly, however the DataAdapter does not update the database. Please help me if you can.
DataRow newRow = categoryDataTable.NewRow();
newRow["catCategoryID"] = test2;
newRow["catCategoryName"] = catTextBox1.Text;
categoryDataTable.Rows.Add(newRow);
categoryDataTable.AcceptChanges();
categoryDataAdapter.Update(categoryDataTable);
|
|
|
|
|
Your code is actually, Adding a row to the table not updating one. Since you are "adding" a row with the same ID as one that already exists and thus the error.
If the row you want to modify is in the table already, all you have to do is:
categoryDataTable.Rows[test2]["catCategoryName"]=catTextBox1.Text;
categoryDataAdapter.Update(categoryDataTable);
Depending on how the DataAdapter is configured it will autmatically accept the changes when it updates.
The other problem is that you called AcceptChanges prior to an update on the DataAdapter. That would tell your dataset/table that the changes have been accepted and to clear the flag saying their are added or modified. That is the flag that the DataAdpater uses to update your data on the server by.
Rocky Moore <><
|
|
|
|
|
Hi, I still cant get it to work. I put the code in that you had, and it did not update. So I wanted to check if it was doing anything, and if I told it to update to a row that was not there, it informed me that the row is not there. The same update command seems to work in other sections when adding new data. Is there anything else you can suggest to help me?
|
|
|
|
|
Hi, sorry, further tests have shown something interesting. Perhaps you can help with this. I have a listbox which is bound to a textbox and I have an update button. If i select something from the listbox, it is displayed in the textbox. When I change it and click update, no changes are made. However, if i select it, change it, then select something else from the listbox (this can even be the same thing again) and then click update - it works. By that i mean it updates the database as it should.
|
|
|
|
|
Are you using any DataBinding on your text box?
For an example. I built a WinForm app and used the Pubs database that comes with SQL Server. I built a SQLDataAdapter to "Select * From Stores" and then built a dataset off that data adapter (in my code I called it "dset".
In the Form contructor after initializeComponents(), I called:
sqlDataAdapter1.Fill(dset)
Next, I added a DataGrid to the form and set it's DataSource to "dset.stores".
Next, I put a button on the form called "Updated".
Next, I put a listbox on the form and added three city names to the listbox collection.
Next, I added a text box (given the ID CityBox)
Next, I double clicked on the ListBox causing a SelectedIndexChanged event handler to generate. In that handler I put:
CityBox.Text = (string) ((ListBox) sender).SelectedItem;
Next, I double clicked on the Update Button and it generated the Click event handler which I put this in:
dset.stores[5].city = CityBox.Text;
sqlDataAdapter1.Update(dset);
That was due to knowing the row I wanted to update. I could have put:
dset.stores.FindBystor_id("8042").city = CityBox.Text;
sqlDataAdapter1.Update(dset);
Of course you would use proper error checking and what not but this is just a quick example.
I can select the item, it updates in the text box and then I click update and it writes out the changes. At least it works here.
If you have any of your controls such as the text control databound and you are working with a CurrencyManager, you might check into EndCurrentEdit.
Or if you are using BeginEdit,EndEdit to delay validation on a Row:
DataSet1.storesRow sr = dset.stores.FindBystor_id("8042");
sr.BeginEdit();
sr.city = CityBox.Text;
sr.EndEdit();
sqlDataAdapter1.Update(dset);
Rocky Moore <><
|
|
|
|
|
The database will not be updated because you call AcceptChanges() before DataAdapter.Update(). After you called AcceptChanges() the RowState for all Rows is "UnChanged". Then you call the DataAdapter.Update() but the Update Method cannot find any Rows which are marked as "Modified", so the DataAdapter doesn't update any rows.
Just call DataAdapter.Update() without AcceptChanges() before and the table will be updated in the database too.
I had the same problem as I started with C# and databases. The microsoft help is also confusing because everywhere is written to use AcceptChanges() to update a datatable.
Hope this helps.
Stefan
|
|
|
|
|
Can anyone help me to realyse ssh2 on c#?
Any links?
Thanks
=====================
http://wasp.elcat.kg
|
|
|
|
|
|
i created a table with 9 columns using datatable and tablestyles.
Also i got a DataRelation.
How can i tell my childcolumn to change if the parentcolumn changes?
e.g. in column "number" is 10 the value,
if value changes to 17 in parenttable,change it also in childttable
Thanx
|
|
|
|
|
Help!
In C# how can I create a few views and according to the view selected from a menu change the view being displayed on the main frame??
Also is it posible to create the different views using the designer?? or doing this will create different frames instead?
Sorry this is for a windows application
|
|
|
|
|
|
In C you could have multiple threads simultaneously writing to the same array but different array indexes without worrying about race conditions.
Can I do the same thing in C#?
I ask because an array in C# is more than just a chunk of memory. Do I need to lock the entire array before I write to a single element even if I know that each thread will be writing to a different index?
|
|
|
|
|
AFAI understand it, you need to create a syncronized version of the collection/set , that would allow many threads to read, but only one to write.
I dont think u need to lock the entire array though, isnt it just possible to lock the element?
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
You're probably best off working with a collection, as .NET collections have built-in synchronization features. Look it up on MSDN.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
albean wrote:
I ask because an array in C# is more than just a chunk of memory.
Not exactly. One-dimension arrays in C# are actually objects that store a pointer to a C-style array, so what you are asking is actually safe on C#, if your algorithm is really thread safe.
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
Excellent explanation! Thanks Daniel.
|
|
|
|
|
but anyways... when I run it, it only displays the last file in the folder, according to alpabetical order... so if there are 3 folders: Alex Ben & Carly.... only the highest letter will show up... Carly...
it does this in every folder.... what's wrong?
here's my full code...
private void Page_Load(object sender, System.EventArgs e)
{
DirectoryInfo di = new DirectoryInfo("C:\\program files\\");
DirectoryInfo[] diArr = di.GetDirectories();
foreach (DirectoryInfo dri in diArr)
{
labelPath.Text=dri.Name;
}
}
/\ |_ E X E GG
|
|
|
|