This is an example for defining a foreign key relationship in Microsoft SQL Server (SQLEXPRESS). There are two tables: Salesperson and Customer (see below). After the SalepersonID column is created in the Customer, it is important to define a foreign key relationship to ensure the referential integrity.
A. The Salesperson table.

B. The Customer table.

C. Foreign Key Relationship
Step 1. Select the SalespersonID column of the Customer table.
Step 2. Select the menu Table Designer >> Relationships…, then the “Foreign Key Relationships” window is desplayed. Locate and click the “Tables And Columns Specification” property.

Step 3. Click the little button (
), then the “Tables and Columns” window is displayed. Make sure that the Foreign key table is Customer. So choose the SalespersonID column as the foreign key column. Then choose Salesperson as the Primary key table; and make its ID column as the primary key column.

Step 4. Click the OK button on the “Tables and Columns” window. Then, click the Close button on the “Foreign Key Relationships” window.
Here is the link: http://asp.dotnetheaven.com/howto/doc/adoplus/DatabaseTrans.aspx. It has examples in C#, VB, and C++.
Changing the startup Windows form (Visual Studio .Net)
March 1, 2007
Starting with SQLEXPRESS (Microsoft SQL Server)
February 19, 2007
It is suggested to manage SQLEXPRESS using SQL Server Management Studio Express, which is free from Microsoft.
1. Download SQL Server Management Studio Express. Go to:
http://www.microsoft.com/downloads/details.aspx?FamilyId=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&DisplayLang=en
2. After install it successfully, open the studio and log on your EQLEXPRESS server. Note that the server name must include EQLEXPRESS following your machine name and Windows Authentication should be used.
3. The Object Explorer is displayed after a successful login.
4. To create a database, right-click the Databases folder and select the New Database menu item.
5. To create a table, right-click the Tables folder and select the New Table menu item.
Defining Autonumber in Microsoft SQL Server (SQLEXPRESS)
February 19, 2007
Connection String for SQLExpress
February 15, 2007
Suppose that your computer name is TAG302757 and you create a database TESTDB in your local SQLExpress server. Then the connection string of the database is:
“Data Source=TAG302757\SQLEXPRESS;Initial Catalog=TESTDB;Integrated Security=True”
Note that there is a space between the words Initial and Catalog; and the the connection string must be in the same line of your VB program.
How to debug Web service in Microsoft Visual Studio 2005
February 12, 2007
You can use the statement Debug.WriteLine(“Web Service Debugging”) in your Web method to debug Web service program. However, the debug message “Web Service Debugging” may not be shown when you run the service from another application project. Follow the instructions below to fix this problem.
- Make sure that you run the Web service from another project inside the same solution.
- Right-click the solution and select the Set StartUp Projects menu. Then the dialog shown in Figure 1 appears.
- Check Multiple startup projects and set the Action properties of your projects to be “start“.
- Start debugging.
- The dialog in Figure 2 may come up. Then click OK to continue.
- The debug message should be written in the Immediate or Output Window. If you cannot see the Immediate Window, click the icon shown in Figure 3 in the tool bar.
Figure 1:
Figure 2:
Figure 3:
Issue of using dynamic ports in Web service projects
February 12, 2007
In Microsoft Visual Studio 2005, port numbers of Visual Web Developer Web Server for tesing your Web service are dynamic by default. This is a problem for another project that creates a Web reference to this Web service. You can set up the Use Dynamic Ports property to false in the Web service project to fix this problem (see the figure below).
Missing the Data Sources window (Visual Studio .Net)
February 10, 2007
If you cannot see the Data Sources window, select the menu Data>>Show Data Sources. If you cannot see the Add New Data Sources icon, right-click the Data Sources window to use the popup menu.
An error occurred while establishing a connection to SQLEXPRESS in Visual Studio 2005
February 9, 2007
Miscosoft Visual Studio 2005 comes with a personal SQL Server (or SQLEXPRESS). You may get an error message when trying to add a connection to the SQLEXPRESS server for your project. The ”Add Connection” dialog usually shows your computer name in the “server name” field. You have to add a back slash and the “SQLEXPRESS” string for a sucessful connection (See the figure below).



