与SQL Express 2005远程连接时出错 [英] Error in remote connection with sql express 2005

查看:87
本文介绍了与SQL Express 2005远程连接时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家

我正在使用C#vs.net 2005和sql express作为后端的项目.我已经成功完成了工作.我想在局域网上连接我的应用程序和SQL Express.我已经在一天前成功连接数据库,但是由于某些问题,我已经在客户端和服务器计算机上格式化了硬盘.

我的应用程序抛出此错误:

Hi Expert

I am working with a project in c# vs.net 2005 and sql express as backend. I have successfully completed the works. I want to connect my application and SQL Express on LAN. I have successfully connected the database one day before but because of some problem I have formatted the hard-disk on both client and server machines.

My application is throwing this error:

Create databse permission denied in database 'master'.
An attempt to attach an auto named database for file
C:\myDB.mdf failed.
a database with same name exist , or specified file cannot be opened, or is located on UNC share.


在这方面,我有一些疑问.

1.有什么方法可以在不使用sql management studio的情况下创建登录名.使用此查询使用PASSWORD ="pwd"创建登录用户"
它执行成功,但出现以下错误:


In this regard I have some questions.

1. Is there any way to create a login without using sql management studio. Using this query "CREATE LOGIN user WITH PASSWORD=''pwd''"
It executes successfully but gave this error:

"Login failed for user user. the user is not associated with a trusted sql server connection"


2.如果我使用Windows身份验证登录,则会收到此错误:


2. If I login with Windows authentication then I receive this error:

Create database permission denied in database 'master'.
An attempt to attach an auto named database for file C:\myDB.mdf failed.
a database with same name exist , or specified file cannot be opened, or is located on UNC share.


我的应用程序有什么问题?
thnx


What is the problem with my application?
thnx

推荐答案

我认为这应该有效,
1.执行以下语句
开始>>运行>> CMD
"osql -S< SQL InstanceName> -E"

更改登录后启用"
去"

使用密码=" pwd更改登录名""
去"

2.检查sqlserver安装路径中的文件myDB.mdf
停止sqlserver服务,删除myDB.mdf文件,然后重试.
I think this should work,
1. execute the following statement
start>>Run>>CMD
"osql -S <SQL InstanceName> -E"

"alter login sa enable"
"go"

"alter login sa with password=''pwd''"
"go"

2. check the file myDB.mdf in sqlserver installation path
stop the sqlserver services delete the myDB.mdf file and try again.


这篇关于与SQL Express 2005远程连接时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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