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

How to create the ADO parameters of a device

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the knowledge of "how to create ADO parameters of equipment". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

ADO parameters for the development of database technicians to Team System commitment, provide relevant tools, which can reduce the entire software development cycle a lot of detours, reduce the complexity of work, I think Vs.Net 2010 will only make our work easier and easier.

Generally rely on existing user databases. Of course, the work of creating a database can be done with the SQL EnterpriseManager tool provided by SQL Server, but if a custom database management tool is provided to manage the database and its equipment needed by the application system, the ADO parameters are undoubtedly more ideal for users.

The two parameters NAME and SIZE are easy to get, but the trouble is the physical name PHYSNAME and virtual device number VDEVNO, the two ADO parameters. The former requires the full path name of a physical file on a server; the latter requires finding a number between 1 and 255 that is not occupied by another device. When writing the database management program, it is impossible to predict which device number has been occupied on the user's server and which drive the SQLServer is installed on.

Although, the use of SQLServer management tool SQLEnterpriseManager, you can easily create, delete database equipment, or expand an existing database, can also be very convenient to create, delete or modify a database, but this tool still requires us to enter a lot of less commonly used parameters, the interface is slightly complex, in order to achieve this goal, we must find a way to solve the parameter setting problem in the SQL statement.

Create ADO parameters for the device

The statement to create the device is the DISKINIT statement mentioned earlier. To simplify the problem, we can specify the same device file name as the database name and save the device file in the same subdirectory as the master device. The database name is determined when you design the application; the subdirectory where the master device is located can be queried from the system table sysdevices. In this way, the physical name parameters of the device file are determined, and the problem of the virtual device number is more complex, because there is no such field as "virtual device number" in the sysdevices system table, so another way must be found.

After analyzing the system stored procedure sp_helpdevice of SQLServer, we find that the virtual device number is "hidden" in the low field of the sysdevices system table. With the help of another system table, spt_values, we can find the virtual device number of each device. In this way, we only need to find out in a loop whether a device number exists in the ADO parameter to determine the virtual device number that we can use now. As for the size of the database equipment, we might as well set it larger, or let the user specify it.

This is the end of "how to create ADO parameters for a device". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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