SQL Server Problems

Source: Internet
Author: User
Tags dotnet

1. About the inability to restore the xxx Database

Create two files XXX. MDF, XXX. LDF, and specify

2. SQL Sever restores XXX. MDF, XXX. LDF, which is attached by the database.

3. Use the COM component to export data to excel:

To use excel in C #, we need to make some preparations First, find tlbimp and excel9.olb in your computer, copy them to a folder, and execute tlbimp excel9.olb in the DOS window, the following three files are generated: excel. DLL, office. DLL and vbide. DLL.

Choose "project"> "add reference" from the menu. In the pop-up dialog box, select "com Imports", click "Browser", and select the three generated DLL files. OK

4. Update SQL

Update A, B set a. Val = B. Val where a. PK = B. PK

How to write?
Oldest missing set keyword

If the primary keys in your A and B Tables are primary keys or have unique indexes
Update (select a. *, B. Val val_ B from a, B where B. PK = A. pk) set val = val_ B;

5. Excel templates

1. Use dcomcnfg to modify the server's Excel access permission

2. generate an Excel file
By searching (the premise is that you install Visual Studio. net and Excel 2000), find tlbimp and excel9.olb in your computer, copy them to a folder, execute tlbimp excel9.olb in the DOS window, then the following three files will be generated: excel. DLL, office. DLL and vbide. DLL.
Alternatively, the xl5chs32. olb and xl5en32. olb files generate an Excel file.

Solution
This problem is very tricky and seems to be stuck in an endless loop. However, after reading this document, we found that it is still very easy to solve. The corresponding tool in DOTNET frameworkcan be converted to the com的database, and tlbimp.exe (you can refer to "C: \ Program Files \ Microsoft Visual Studio.. NET 2003 \ SDK \ V1.1 ). Tlbimp can package a COM component into a class library that can be used by DOTNET. The automatic conversion of vs. NET is also a tool. This tool has many parameter switches. You only need to enable one additional switch for strong names. The following describes the parameters that I think are most likely to use:
/Out: Filename: name of the output file after the type library is converted.
/Namespace: namespace used for Type Library conversion.
/Keyfile: Filename: Specifies the SNK file used for conversion. This parameter indicates that the constructed Type Library has a strong name.
The complete example is as follows:
Tlbimp excel.exe/out: InterOP. Excel. dll/namespace: Excel/Keyfile: excel. SNK
The SNK file can be generated by using another tool Sn in dotnet, which is not described here.
After completing the above work, you can directly reference the Type Library we constructed in the project to successfully compile a DLL with a strong name.

If it is a control but not a common component, you cannot use tlbimp. if you use the aximp.exe tool in a way similar to tlbimp, the tool generates two files: A proxy file of the Type Library and a proxy file of Windows form.

Further Solution
However, a simpler solution is to set the "wrapper Assembly key file" (common properties \ General \ wrapper Assembly key file) in the project attributes. After this attribute is set, the COM/ActiveX components added through add reference will all be identified with a strong name.
This requires one setup, which should be more convenient.

Self-built http://www.omice.com/standy/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.