|
I have same problem as in the linke given by you. Bt I am not getting how it will solve...
plz help..
|
|
|
|
|
Just go through whole article, the resolution is below related questions links.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
sorry to disturb u again....
I am not able to find related questions links.
|
|
|
|
|
This code might get you on the right track:
XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
namespaces.Add("", "");
namespaces.Add("xsi", "http://www.w3.org/2001/XMLSchema");
XmlSerializer serializer = new XmlSerializer(typeof(MyObject));
serializer.Serialize(File.Create("all.xml"), customers, namespaces);
|
|
|
|
|
hello
I have serialized that objects into xml. But problem is in desrialization due to "xsi:type=VALUE".
I have also serialized using code given by U bt still deserialization is problem.
Plz do needful...
Thanks in adv.
|
|
|
|
|
Did you deserialize with the code given? Also, my code is a starting point for something to try. Attempt variations of namespaces, etc.
|
|
|
|
|
I think given code is for serialization not for deserialization because u used serialize() method instead deserialize() and also create an *.xml file. If I am wrong then plz guide me.
Thnx in adv...
|
|
|
|
|
Hello all
Im comparing two data tables(with same structure)and i want to insert the row difference into the first table
eg
table 1 table 2
ColA ColB ColC ColA ColB ColC
A B C A B C
C D A A A A <---new row
D A C C D A
D A C
as you can see , 2nd row in table 2 is new and I want to insert the difference into table1
|
|
|
|
|
There isn't any automated way to achieve the same.
You need to do it manually.
Just loop datatable for the number of rows for the
datatable has greater rows. i.e.
DataTable1 contains 5 rows
DataTable2 contains 6 rows
then write
for(i=0;i<<DataTable2.Rows.Count;i++)
{
for(j=0;j<<DataTable1.Rows.Count;j++)
{
for(t=0;t<<DataTable1.Columns.Count;t++)
{
}
}
}
Then manually compare each row and each column. You need to take two flags.
First flag set when the column of DataTable1 is not matched with DataTable2
for particular row.
Second flag set when there is new row in DataTable2 not matched with any row
of DataTable1.
And accordingly you can take actions.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
The first thing to try is an INSERT...SELECT...WHERE statement, but that won't work in all cases.
If I have to resort to programming, then depending on the situation (number of rows and columns etc.), I might just throw all the rows in table 2 at table 1 and see what sticks.
0) Ensure that table 1 has a unique index that covers everything that needs to be covered.
1) Set up a parameterized INSERT command for table 1 (this requires a second Connection)
2) Open a DataReader against table 2.
3) Iterate the DataReader
3.1) Set the parameters
3.2) In a try/catch, Execute the INSERT, and ignore (or log) duplicate exceptions
This allows the database to check whether or not the row exists so you don't wind up checking it twice. The big sticking point is the index -- how much data will need to be in the index?
You may also want a Transaction.
Edit: Oh, wait, you meant DataTables? Why would you need to do that?
|
|
|
|
|
Hello,
I am using C# desktop applications.Here I am saving some files into the database and i wanted to read those files back and depending upon my extension it should open in corresponding files.For eg,.doc file in msword,pdf in adobe like that.
I am facing a problem in opening the file .I have binary data in a byte array.How will i do it.Please help
seeism
|
|
|
|
|
Most apps need physical files for their documents, so create a document file (could be in a temp folder), then pass its path to Process.Start() to launch the associated application to open it.
Note: the app may remain open after you're done.
|
|
|
|
|
hey
thanks for that
this is what i actually want.Now i able to open a word document if my file that stored was doc but it is coming as junk value.What could be the reason ???
seeism
|
|
|
|
|
Hi,
I am able to read only the first char of bytes from db.What could be the reason.Now in txt file ,it is opening and prints the first char but for doc,it is coming junk data
seeism
|
|
|
|
|
|
Hi,
I am not getting any error.I just want to open a file in the same application and now my problem is solved using this
String new_FileName = Path.ChangeExtension(Path.GetTempFileName(), "txt");
File.WriteAllBytes(new_FileName, result);
System.Diagnostics.Process.Start(new_FileName);
But now i getting junk values for doc data.
|
|
|
|
|
why would you change the extension? if it is a Word document, NotePad will not be able to open it properly.
The normal thing to do is to use two database fields: one for the filename (including extension!), one for the binary data (the actual file content).
|
|
|
|
|
Soory i pasted the code for txt here.I put it as doc while opening the doc file.For doc file it is coming junk data.For txt first char is printing
SqlDataReader dr = cmd.ExecuteReader();
DataTable dt = new DataTable());
dt.Load(dr);
result = (Byte[])dt.Rows[0]["File_Doc"];
when i check this result array it is contiaing the first byte value and all others r zero
Why so
|
|
|
|
|
use your database management tool to check the content of the field, and determine whether the problem is in storing or in retrieving the data.
BTW: you don't need a DataReader, a simple ExecuteScalar could suffice, see here e.g.: Save An Image Into SQL Server 2000 Database[^]
|
|
|
|
|
I am not much familiar with sql server.How to view the binary data in sql server.
??
|
|
|
|
|
Hey
my probs was solved.oops that was a mistake in the stored proc where i didn mentioned the size of binary data.SO only one data was storing
thanks a lot for ur help.
|
|
|
|
|
Gentleman,
I wrote an application that needs to get the Processor ID from the OS. I have been using it exactly as designed below for the last several years on Win XP and Vista. A recent user of this app reported to me that he is getting an error that would indicate that the Processor Id is not being returned as designed. Now, the only difference that I know of is that he is using Windows 7. Question: is there any reason why the Management Class call that I have here will not work on Win 7?...or should I look for a different problem elsewhere? Thank you in advance...Pat
public string GetProcId()
{
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (cpuSerial == string.Empty || cpuSerial == null)
{
cpuSerial = mo.Properties["ProcessorId"].Value.ToString();
cpuSerial = cpuSerial.ToUpper().Trim();
}
}
return cpuSerial;
}
|
|
|
|
|
I've never seen code like that; the normal way to interact with Win32_Processor seems to be like this one[^], which works fine for me on XP and Vista.
Probably your Win7 is 64-bit and your code somehow isn't compatible with that, whereas the alternative probably is (can't test right now).
|
|
|
|
|
Thank you for your reply, Luc. As is often the case, there is more than one way to get from here to there. I have been using this exact snippet since at least 2004 and with series 2.0, 3.0, and 3.5 framework...it has always worked in the past and I can find similar examples on the net as well. I have personally tested it on XP, Vista, and 2003 Server and it works fine. This is the first time this has happened, but I until I know why, I have to stop distribution of the program. You have a nice idea re: the Bit version, so I checked it out and this guy is using XP Pro 32 bit, so that lets that idea out. I appreciate your input though, and if you come up with another idea, I'm certainly listening...
Best Regards, Pat
|
|
|
|
|
I have a treeview with ownerdrawn nodes. I also set an invividual indent value for each node, so each node has new bounds. The problem occurs on mouseover, hottracking is not triggered when mousing over the the last portion of the node - portion that equals to the length of the indent. Is there a way to set the mouseover bounds or maybe catch the event that triggers hottracking and force hottracking when mousing over the new bounds?
|
|
|
|