Write the extended stored procedure with VS.NET (1)

xiaoxiao2021-03-06  91

Just talked to the girlfriend. Really, I miss ancient times. Now this year, I don't want to offer marriage. From recognizing the process of being familiar with the official construction to the cave, it is enough to let a middle class bankrupt, let a vibrant youth become diamond Wang Lao Fous.

I was complaining. I suddenly wanted to eat tomatoes in the past few days. I just bought five pounds in the refrigerator in the morning. Please prepare for the list of officials, and you will see where you don't want to go. ... I am grateful ...

To the point. First, please confirm that Microsoft VS.NET 2003 and Microsoft SQL Server 2000 have been installed on your computer.

For some simple processes, I am no longer detailed. For example, "Select all programs in the start menu -> Microsoft Visual Studio .Net 2003-> Microsoft Visual Studio .NET 2003 ... Click File -> New-> Project ... Select the General C items in the generals of the extended stored procedure DLL ...... Enter xs_xxxx ... Click OK ", this article will only be described in this article: New extended stored procedure DLL project XS_XXXX in vs.net; for example, select Microsoft SQL ... Haha, tomato Ah ~~ I can't be too greedy, let it! ^ _ ^

First, establish a database framework

Use SQL Sever to create a database Railway and join two tables in Railway:

Routes (? Trainid (int) ,? allstations (nvarchar (2000))) and trains (?? trainid (int)) Underline representation of primary key, two items in the Trains table, is For the alias of the train, such as T1 = Express 1 = special 1, etc.

Finally, add the following records in the ROUTE table: (0, '| Beijing, 0 hours | Shijiazhuang, 2 hours | Zhengzhou, 4 hours | Wuchang, 4 hours | Guangzhou, 9 hours |') (1, '| Harbin, 0 Hours | Beijing, 7 hours | Shijiazhuang, 1 hour | Zhengzhou, 4 hours | Xi'an, 6 hours | Chengdu, 10 hours | ') Add: (0,' J1 ') (0,' Extreme 1 ' ) (1, 'J2') (1, 'Extreme 2') Route Table The format is' | Starting Station, 0 Hours | Next Station, Time from the previous stop | ... | endpoint Station, time from the previous stop | '

It should be explained that the two records joined is that all geographic knowledge designs in the brain is mobilized. Is it very admiring me? ............ Don't you have, more! Halo, how can you throw bricks? ......

Second, put forward the problem:

1. Find the fastest route from Beijing to Zhengzhou; 2. Looking for Harbin to Guangzhou's fastest route.

The first question is easy to watch, because J1 and J2 have passed Beijing and Zhengzhou, as long as the two lines are faster. The result should be J2 wins, 5 hours. This issue is also easy to solve without extending the stored procedure.

The second problem is relatively complex. Affirmation needs to be transferred, but should choose which as a transfer station? Beijing, Shijiazhuang is Zhengzhou? Although the algorithm of this problem is not difficult, it is difficult to write in the ordinary storage process.

In the next section, the first problem with the expansion stored procedure will be described.

转载请注明原文地址:https://www.9cbs.com/read-123136.html

New Post(0)