VS Connect SQL Server solution with C language

Source: Internet
Author: User

I asked this question on the CSDN forum, but no one talked me about it, and I finally got it done.

The original link, there is no solution, the following provides a workaround.

Confirm that the SQL Server service is open

First, manage access from my Computer, right-click

Confirm that the SQL Server service is open.

You can also use cmd (Command Line window), open cmd as an administrator, enter

netstart[服务名]

The effect is as follows:

If there are spaces in the middle of the service name, be sure to add double quotes.

Configure ODBC

See links for specific methods.

Be sure to note that the server name in the code must be the name of the data source, which is the "SQLSERVER2008_ODBC" in the connection.

Second, your username and password will also be the password to set the data source, i.e. "sa" and * * * * * * * * * *.

Finally, be sure to verify that the test was successful.

Code issues

Grammar I do not say here, but please do not write wrong.

In general, this is the wrong step.
In the code, make sure your SY (data source name), DB2 (username), pass (password), must be the same as your data source settings and SQL Server settings.

Engineering issues created

I am stuck at this point above.
Generally speaking, we will use the WIN32 console application to write C + +. But if you're creating that project, you can't even do it. You can try VC + +, there may be no such restrictions.

Be sure to create an empty project with VC + +

By this step, it can be solved successfully.
If there is a problem, then GG (but it is estimated that it is the problem of the code).

VS Connect SQL Server solution with C language

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.