Wednesday, March 21, 2012

I cant connect to my Local DataBase please help...

DBconn.cs

private DBConn()
{
//
// TODO: 在這裡加入建構函式的程式碼
//
this.Server=Property.getProperty("DBServer");
this.port=int.Parse(Property.getProperty("DBPort"));
this.User=Property.getProperty("DBUser");
this.Pwd=Property.getProperty("DBPwd");
this.db=Property.getProperty("DBDatabase");
this.ConnectionString="server=" + this.Server+","+this.port+";database="+this.db+";uid="+this.User+";pwd="+this.Pwd+";Connect Timeout=60";

}

--------------------------------

propetry.config

<property name="DBServer" value="127.0.0.1" />
<property name="DBPort" value="1433" />
<property name="DBDatabase" value="CSLC" />
<property name="DBUser" value="CSLCUser" />
<property name="DBPwd" value="resslc" />

I use this way to call my connecting string , but I can't connect to my local DataBase , I trid to modify the propetry.config to coneect to other DataBase on other Server it works

only when Connecting with my Local DataBase , it not work...

this problem have been troble me more than 3 weeks... ask many people no one can resolve this problem...

when I am at home . I can't work... because I can't connect to the Server when I'm in office..

pleaes help... thank you very much

Change your DBServer property to(local).

|||

I have tried this way before

the property.config was looks like below

propetry.config

<property name="DBServer" value="local" />
<property name="DBPort" value="1433" />
<property name="DBDatabase" value="CSLC" />
<property name="DBUser" value="CSLCUser" />
<property name="DBPwd" value="resslc" />

it doesn't work as well... please help..

|||

It should be

 <property name="DBServer" value="(local)" /> <property name="DBPort" value="1433" /> <property name="DBDatabase" value="CSLC" /> <property name="DBUser" value="CSLCUser" /> <property name="DBPwd" value="resslc" />
|||

yes, I did

now it looks like

<property name="DBServer" value="(local)" />
<property name="DBPort" value="1433" />
<property name="DBDatabase" value="CSLC" />
<property name="DBUser" value="CSLCUser" />
<property name="DBPwd" value="resslc" />

it still fail when Coneecting with DB... is it possible wrong SQL Server Setting? like security problem?

can you teach me how to check if problem is from SQL Server Setting please? thank you very much

|||

Start off with going to http://www.connectionstrings.com to get a "good" connection string for your application. Verify that you can connect to the SQL Server. Try using Visual Studio to connect. Upon successful connection copy that string to your configuration. My guess is the TCP ip connections are disabled on your SQL Server or someone changed the port.

|||

thank you

can you teach me how to start check if the problem is from "The TCP ip connections are disabled on your SQL Server or someone changed the port. "

because I use some small program to enable to connect to MSN messenger when I'm in office , it always change my proxy into 127.0.0.1

maybe there is something been changed but I don't know..

thank you very much

|||

anyone? please help.. please...

|||

Hi jcjcjc,

can you teach me how to start check if the problem is from "The TCP ip connections are disabled on your SQL Server or someone changed the port. "

which version of sql server are you using? if you are using sql 2005, open sql server configuration manager (there are corresponding tools for sql express and sql 2000) and click sql server 2005 network configurateion-->Protocols for YOURSERVERNAME-->TCP/IP make sure tcp/ip connection is enabled.

Actually, i would suggest you first open your windows service list (control panel->administrational tools--> services) and see if your sql server service is started up.

Hope my suggestion helps

|||

I use SQL 2000, and the weird thing is.. only this project can't connect with local DataBase
but others does...


No comments:

Post a Comment