Sunday 15 July 2012

c# - Connecting to SQL server via TCP/IP, not NP -



c# - Connecting to SQL server via TCP/IP, not NP -

as found out, sql server has disabled named pipes, enabled tcp/ip (and remain way). trying connect visual studio database, no luck. i've tried far:

string connstring = "data source=192.168.1.1:1433 ;initial catalog=np-sparcsn4-custom;persist security info=true;user id=xxxx;password=/*****/"; string connstring = "data source=192.168.1.1:1433 ; network library=dbmssocn; initial catalog=np-sparcsn4-custom;persist security info=true;user id=xxxx;password=/*****/";

i've tried replace ip address name - no luck. when seek connect using table adapter can preview data, same if i'd utilize i.e. grid - in code can't open connection it: have network related or server specific error, either

named pipes provider: not open connection sql server [5]

or

provider: named pipes provider, error: 40 - not open connection sql server

server set take remote connection , accessible.

update:

i've tried

string connstring = "server=tcp:192.168.1.1,1433 ;initial catalog=np-sparcsn4-custom;persist security info=true;user id=xxx;password=/****/";

or

"server=tcp:ponln4report,1433 ....

and i've got error:

provider: tcp provider, error: 0 - non-recoverable error occurred during database lookup**strong text**

edi2: i've found older sql server 2005 can connect without problem. bit of pain because lacks i.e. date , time info types, guess has now.

for c#, utilize connection string

connectionstring="data source=192.168.1.1,1433;initial catalog=np-sparcsn4-custom;integrated security=false;user id=your_username;password=your_password"

if need modify web.config file, add together node:

<connectionstrings> <remove name="localsqlserver" /> <add name="localsqlserver" connectionstring="data source=192.168.1.1,1433;initial catalog=np-sparcsn4-custom;integrated security=false;user id=your_username;password=your_password" providername="system.data.sqlclient" /> </connectionstrings>

c# sql-server sql-server-2008 ado.net connection-string

No comments:

Post a Comment