如何正确地在新的SQL服务器中添加旧数据库 [英] How to add old database in new SQL server properly

查看:133
本文介绍了如何正确地在新的SQL服务器中添加旧数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我卸载旧的SQLserver并安装新的sql server 2012现在我在我的sql server 2012中添加了我的旧数据库,然后在我的C#项目中连接这个旧数据库发生错误。

感染我创建一个新的数据库并制作新的C#项目,然后连接它就可以了。但我不能使用我的旧数据库

请帮我解决这个错误。

发生此错误

I uninstall my old SQLserver and Install new sql server 2012 Now i add My old Database in my sql server 2012 and then i Connect this old database in my C# project An Error is occurred.
Infect I make a new database and make new C# project and then connect it it work good. but my not work with my OLD Database
Please help me how i remove this error.
This Error is occurred

System.Data.SqlClient.SqlException: 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)'





什么我试过了:



我的连接字符串类。



What I have tried:

its my connection string class.

namespace CNG
{
   public class dbconfig
    {
        public static string connectDb()
        {
            string conString = @" Data Source = CTRLSOFT - ELDHL3\SQLEXPRESS; Initial Catalog = CNG; Integrated Security = True";
            return conString;
        }
    }
}

推荐答案

我认为问题出在String ...

验证字符串如

服务器名称,数据库名称
I think the problem is in the String...
Verify the strings like
server name, database name


这篇关于如何正确地在新的SQL服务器中添加旧数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆