Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sample Analysis of VS.NET2005 trial

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

VS.NET2005 trial example analysis, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Recently, I tried out a gadget with vs.net2005 beta2, which is really easy to use, but I haven't used vs.net2003 much. But I just like to taste something fresh, so I can't help it (I don't know if there are many people like me who want to try something new when they see something new, so that my operating system always breaks down very quickly). Of course, another reason I use vs.net2005 is that it provides serialport class to operate serial port. It is more convenient to communicate with the serial port of some embedded systems. I found a small problem in the process of using it. Because it was just a gadget, I didn't want to use the database, so I chose the untyped dataset function of dataset to access binary files. As a result, when I used the datatable.find function, I could not find the record. My code is like this:

Public void create () {dataset = new dataset (); dataset.remotingformat = serializationformat.binary; datatable = new datatable (); dataset.tables.add (datatable); datatable.columns.add (new datacolumn ("card_no")); datatable.columns.add (new datacolumn ("member_no")) Datatable.columns.add (new datacolumn ("serial_no")); datatable.columns.add (new datacolumn ("expiry_date", type.gettype ("system.datetime")); datacolumn [] keys = new datacolumn [1]; keys [0] = datatable.columns ["serial_no"]; datatable.primarykey = keys } public void open (sspaning filename) {if (file.exists (filename)) {binaryformatter bf = new binaryformatter (); filesspaneam fs = new filesspaneam (filename, filemode.open); spany {/ / dataset.readxml (filename) / / dataset.acceptchanges (); dataset = (dataset) bf.deserialize (fs); dataset.acceptchanges ();} finally {fs.close () } public void save (sspaning filename) {if (dataset.haschanges ()) {binaryformatter bf = new binaryformatter (); filesspaneam fs = new filesspaneam (filename, filemode.create); spany {/ / dataset.writexml (filename) Bf.serialize (fs, dataset); dataset.acceptchanges ();} finally {fs.close ();}

When using datatable.rows.find (), it is clear that there is data in table, but it always returns null, but it is no problem to use the readxml,writexml function to manipulate xml format to store it (that is, a bit more diffuse, which is why I want to use binary format). I don't know if I missed some steps, but the instructions on msdn2 are still a little simple. On the whole, however, VS.NET2005 is very useful.

After reading the above, have you mastered the method of sample analysis in VS.NET2005 trial? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report