|
Look in the .NET Framework SDK for the class documentation for those classes, interfaces, and structs in the System.Security.Cryptography namespace. There are also many examples here on CodeProject. Just do a search for "encrypt" or something simple.
A good understanding of cryptography will definitely be helpful, such as knowing what exactly cryptography is, shared key and private key architectures, etc. Crytography is definitely not something to take lightly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I'm looking for a possibility to get the building (last compilation!) Date and Time of my C# Application, during runtime.
Does anybody know ho I can get these information.
thanks in advance
Jörg
|
|
|
|
|
Yeah. The creation date and time of your .EXE will be the compile data and time.
FileInfo fi1 = new FileInfo( Application.ExecutablePath );
CompileDate = fi1.CreationTime
RageInTheMachine9532
|
|
|
|
|
Yes, this info is stored in the assembly in the metadata, not sure how accessible it is.
OK heres a hack Will work for just about any exe file as this data is embedded in the PE file header.
public static DateTime GetTimeStamp(string filename)
{
Stream s = File.OpenRead(filename);
s.Position = 132 + 4;
byte[] data = new byte[4];
s.Read(data, 0, 4);
s.Close();
return new DateTime(1970, 1,1).AddSeconds(BitConverter.ToUInt32(data, 0));
}
top secret
|
|
|
|
|
|
Hi everyone.
Yesterday I started a thread and was grateful to have received such knowledgable responses. It was great! I ended that thread in saying that today would be a journey in that I had to now feed elements of my XML(converted from a .csv) document into a datagrid in order to display data in a very clear way.
I converted the csv using the XMLWriter class and now know that I must use the XMLReader class to read this data but I do not know how to get a step further. In otherwords, I am not sure how to read the elements and put them in the datagrid.
Any help would be greatly appreciated
Thank you
Skylo
P.S. Does anyone use and/or have an opinion of the open source datagrid that one can download on this site?
...one of the main causes of the fall of the Roman Empire was that,
lacking zero,
they had no way to indicate successful termination of their C programs.
-Robert Firth-
|
|
|
|
|
You don't need to use an XmlReader to display your data in a DataGrid . You can use the ReadXml method of DataSet and then assign that DataSet to be the data source of the grid in question.
DataSet ds = new DataSet();
ds.ReadXml(@"C:\MyXmlFile.xml");
MyDataGrid.SetDataBinding(ds, "MyTable"); Apply a DataGridTableStyle to gain more control over how the data is displayed.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hello,
After you edit a XmlNodelist in c#, is it possible to "paste" the XmlNodeList into another file that has the same structure? (so a node is being replaced by the one that was edited)
Thx
e.g.
I want this xml-node int the xml-file, and replace the 'old' node
<authors s="male">
<id>172-32-1176</id>
<lname>Black</lname>
</authors>
<AuthorsTable>
<authors s="male">
<id>172-32-1176</id>
<lname>White</lname>
</authors>
<authors s="female">
<id>213-46-8915</id>
<lname>Green</lname>
</authors>
</AuthorsTable>
|
|
|
|
|
Replace one node's InnerXml with to other node's InnerXml...
|
|
|
|
|
Replace one node's InnerXml with the other node's InnerXml...
|
|
|
|
|
Deal all,
I have a problem that I have to load a huge amount of data into the SQL server it is about a million record from some binary files, in this case I have to ways to do it, the first one is use the old ADO library any load it by using record set the speed here is acceptable, but in the second ay I would like to use ADO.Net I have to fill that data into a dataset and to use SQLDataAdaptor to update my database which will take very long time. So if any body knows a faster way for that by using ADO.Net libraries
Regrads
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Insread of loading your data into DataSet , use SqlDataReader to read records. Also create stored procedure and use SqlCommand class to run them from your application. This will very better performance than using DataSet for large number of datas.
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
You parameterized queries for batch updates, like so (assumes insert only, such as for a data wharehouse):
SqlConnection conn = new SqlConnection("...");
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO MyTable (Field1, Field2, Field3) " +
"VALUES(@Field1, @Field2, @Field3)";
SqlParameter param1 = cmd.Parameters.Add("@Field1", SqlDbType.BitInt);
SqlParameter param2 = cmd.Parameters.Add("@Field2", SqlDbType.NVarChar, 40);
SqlParameter param3 = cmd.Parameters.Add("@Field3", SqlDbType.NVarChar, 40);
using (conn)
{
conn.Open();
while (true)
{
string line = read next line from data file;
string[] fields = line.Split(',');
int id = Convert.ToInt32(fields[0]);
param1.Value = id;
param2.Value = fields[1];
param2.Value = fields[2];
cmd.ExecuteNonQuery();
}
} This should give you some idea of what to do. Also, don't use stored procs like Mazdak mentioned. There is a performance penalty when using simple statements like this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear Heath,
Thanks for help, i think that this is a traditional way to solve the problem it has a problem: when you try to load this amount of data without closing the data connection you should expand the log file of the sql server to be about 512 MB else will get an erreor message which tell you that sql server could not save transaction data,
and if we don't like to open and close the connection we should open a transaction and commit it evry data block.
i have an other idea: if we can devide that data to some blocks then i will pass evry block to a thread which will insert it into the data base with a new connection ... it is an idea i did not try it but i will and i think it will enhance the application performance
Regards
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Perhaps, but this isn't the SQL forum.
If youre application doesn't need to do this as part of some more complex functions (i.e., you just need to do it internally from time to time), you should actually check out the bcp utility that ships with SQL Server, or use the BULK INSERT SQL statement (which I see no reason why it couldn't be used with ADO.NET to execute it) which does all this work for you.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You may want to look into Sql Server's Bulk copy functionality to do your inserts.
|
|
|
|
|
You may want to take a look at using SQL Server's Data Transformation Services(DTS) to perform the load. From your short description, it sounds like the kind of problem that DTS was made for.
Using an ActiveX task, you could make use of a COM-registered .NET assembly (or traditional COM object) to perform any advanced transformations needed on the binary source. Also, if this is a recurring task, DTS packages integrate nicely with SQL Server's job scheduler.
Hope that helps.
--Jesse
|
|
|
|
|
Dear Sir,
Thank you for your help, but i am searching for a solution which depend only on .net technology without using COM technology
regards
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
I have created a control based on the TextBox control, and would appreciate if someone could tell me how I can get the background to be painted with a brush using the HatchStyle and HatchStyle.OutlinedDiamond. The OnBackGround(...) and OnPaid (...) events don't seem to get fired off. I want to only have the background drawn with the HatchStyle.OutlinedDiamond as design time, and to have the normal background at runtime.
|
|
|
|
|
Easy, you cant! You will have to write one from scratch.
top secret
|
|
|
|
|
I want to close resource used by the web cam it gives error when i open the camara.......
|
|
|
|
|
Details! Lots more details!
Which webcam?
What are you using to communication with the webcam?
Are you using API calls and which ones?
Are you using WIA? The manufacturer's SDK?...
Code snippets of what your doing also help GREATLY!
RageInTheMachine9532
|
|
|
|
|
Hello,
If i have a simple Xml-file like this:
<test nummer="1">
<school name="handel">
<director> guy</director>
<teur> qui</teur>
</school>
<school name="bedrijf">
<director> louis</director>
<teur> qyu</teur>
</school>
</test>
How can i get the attributes "handel" en "bedrijf" in a textbox?
thx in advance
|
|
|
|
|
Use XPathDocument class. Search for it in google or this site for examples.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Have a look at the XPath tutorial at www.zvon.org. The XPath for attributes uses the @ symbol, so the XPath to get the school name attributes is: /test/school@name.
Using this in .NET (C#):
XmlDocument test = new XmlDocument();
test.LoadXml(pathToXmlFile);
// to get just the first (or a school at any position) school name, use [position] in the XPath
TextBox.Text = test.SelectSingleNode("/test/school[1]@name").InnerText;
// to get all school names
XmlNodeList list = test.SelectNodes("/test/school@name");
foreach(XmlNode node in list)
{
// process nodes here....
}
|
|
|
|