|
Hmm... don't really care for its dictionary style XML output (makes the files a lot bigger then they need to be) and couldn't find a quick way to turn that off, but I looked around for another open source serializer based on your suggestion and found YaxLib... gonna see if I can hook my encryption into that one.
|
|
|
|
|
You're going to have to use reflection to find the encrypted properties in some way. That last suggestion of yours doesn't sound that bad to me. Deserialisation might be a pain in that case though.
|
|
|
|
|
I was thinking about this on the way into work this morning. You are right. The encrypted version is always going to be a string. Even if the underlying value is an int or something, so I'd have to find a way to store the temp string value before decrypting it to the real type. Currently looking into modding an open source serializer to support encryption "the right way".
|
|
|
|
|
Binary formatter solves this by providing custom serialization option. It calls OnSerializing, OnSerialized, OnDeserializing and OnDeserialized methods. There may be a similar solution for XML Serializer, you may also try this.
|
|
|
|
|
Could someone explain the best method for deleting all rows from a datatable where the value in column 0 is zero? I'm not sure how to handle the indexing after a row has been deleted...
Many thanks
|
|
|
|
|
One way is that you loop through the rows and test if the row satisfies with your condition. So something like:
foreach(System.Data.DataRow datarow in mydatatable.Rows) {
if ((int)datarow["columnname"] == 0) {
datarow.Delete();
}
}
mydatatable.AcceptChanges();
For more information, see: DataRow.Delete Method[^]
|
|
|
|
|
Thanks for the response. I forgot to mention that my column's type is double. I tried your code and got an error, so I changed it to :-
foreach (System.Data.DataRow datarow in tblStanding.Rows)
{
if ((double)datarow["Charge"] == 0)
{
datarow.Delete();
}
}
tblStanding.AcceptChanges();
...and I get this error:-
"Collection was modified; enumeration operation might not execute."
Any ideas why?
|
|
|
|
|
Sorry, my mistake. The safest way to loop through the rows when modifying them is to use the index. So try something like:
for (int counter = tblStanding.Rows.Count - 1; counter >= 0; counter--) {
if ((double)tblStanding.Rows[counter]["Charge"] == 0)
{
tblStanding.Rows[counter].Delete();
}
}
tblStanding.AcceptChanges();
modified 6-Jan-13 16:31pm.
|
|
|
|
|
I tried the code and got this message :-
The name 'datarow' does not exist in the current context"
So, I tried changing the code to:-
tblStanding.Rows[counter].Delete();
That ran, but the rows with zeros weren't deleted??
Edit - Strangely some of the rows with zeros were deleted, but some remain??
|
|
|
|
|
That was still left from the previous version. I corrected the original answer.
The rows aren't deleted until you call AcceptChanges. They are only marked to be deleted. So depending if you have a database where you want to reflect the changes, you can first mark the rows to be deleted, actually delete from a database and the accept any pending changes.
Have a look at DataTable.AcceptChanges Method[^]
|
|
|
|
|
Accept changes was called. As per the edit in my previous post, only some of the rows with zeros have been removed?
Is the indexing here working correctly? I've seen other methods were the loop starts at the bottom of the table.
|
|
|
|
|
You're correct, looping from the end is working since when an item is removed, it would be 'skipped' if looping forward.
|
|
|
|
|
Sorry - I didn't notice your loop was starting at the bottom
I will try and figure out why only some zeros are being removed. Thanks for your help.
|
|
|
|
|
You're welcome, hopefully you find the reason. If needed, post a new question to the forums
|
|
|
|
|
Hi
i have problem in this senario :
I have Sql server database 2008 R2 ,
Entity FrameWork 4 with ModelFirst approach
project : PM software with GIS
beacuse security we decided that security of system implemented with RLS(Row level Security ) on server side (DBMS) , i mean with Schema and View on Sql only Record's of views showed up for valid user ,
and for Views in SQL don't have relation to other views
" for example tables that we connect their relation wity PK and FK "
when i generate EF model from database only i add views in the Model
so , i corrected Name Of Views with polorilize , change Updatableview Confige for any view that supported as well as Table ,
and by hand i connect all relation between entities that made up of views
by Navigation panel and association Tool
what's the problem :
beacuse i created all relation in EDM between entitys and thease not exsit in between of views
,
any time i change fileds,views , name of views , schema of view and important of them New Views with New Schema and ,...
when I update model by EF EDm (ModelFirst)
all of older entities crashed ,
all of realation between entities damaged
, and all change not returned
note :
for speed , security and distributed business of system
we tryed all proccess and all calculation on server sidee
plaese Help me....
Regard
DOT NET Developer
Ali Sarshogh . Iran country.Isfahan City
Chief programmer.
|
|
|
|
|
Hi,
So I am to design an application with some basic functionality and hardware interface (COMs etc), have decided to use C#.
The System which the app run on will be WinXp, without Internet and it will be a dedicated system to run that app ONLY, nothing else has to be run on it, there will be keyboard/mouse to sue the app but the user is not expected to go elsewhere, not be able to close the app and app should start-up as XP starts, no explorer,task manager etc.
It is for a dedicated POS terminal... can someone here please guide me a bit in the right direction, I am sort of lost as from where to start.
I know I will need to put the app in startup to get it running when system starts and somehow keep explorer from starting, I can capture key sequences and/or disable Windows shortcuts altogether (don't know how), provide a control to shutdown PC from within the app.
Note: the user is not the opponent, he is not deliberately trying to get out of the app, I hope.
Does anyonehave experience with this type of requirement.
|
|
|
|
|
Zaid Pirwani wrote: Does anyonehave experience with this type of requirement.
Kiosk mode[^]
|
|
|
|
|
KIOSK, so this was the magic word I was missing.... simply didn't came to mind.
THANKS for the tutorial link.
|
|
|
|
|
You're welcome
|
|
|
|
|
As noted in the other thread kiosk is the key word but do further research on it besides just the one tutorial.
There are many clever ways to break a kiosk and you should insure that at least the common ones are not allowed.
|
|
|
|
|
when I try to open a office word file with c# in website, everything is working fine on my local machine. However when I upload the files to hosting server I receive an error like:
"Could not load file or assembly 'office, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c' or one of its dependencies.
The system cannot find the file specified".
I have learned that hosting server machine hasn't installed office version because of licence an security reasons.
How can I solve this problem ?maybe can I reference a dll file on client machine to open the word document with c# code or .. please help me about it.
|
|
|
|
|
a.ergin wrote: How can I solve this problem ?m
Try to place the assembly 'office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' on the server. Don't install office, just copy the assembly from your local system on the server and see.
a.ergin wrote: can I reference a dll file on client machine to open the word document with c# code
You need to place the assembly where the code runs. If it's a desktop app, provide assembly on system where it runs.
|
|
|
|
|
actually, at first there had been a problem with the web.config file and web project never starts. Then, I had put the file
Microsoft.Office.Interop.Word.dll
in to the bin folder(inside my project) and my application starts however when I navigate through to the page and hit the button which runs the code to open word file. I had received errorlines could not load file or... I had post in my previous posted massage.
I have tried to put some other dll files in bin folder but it did not work.. please help me about this problem..
|
|
|
|
|
|
Yes button event handler in the codebehind file works on the server side.
the solution that you have sent including the third one usefull for me.
thanks alot
|
|
|
|