Showing posts with label address. Show all posts
Showing posts with label address. Show all posts

Tuesday, March 20, 2012

Can not access SQL Server

Hi,
In this case, the environment is:
Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address: 10.35.3.43)
Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a WinForms
application. (In the same subnet)
In the WinForms application, I can connect to the SQL server sucessfully,
but in the ASP.Net application, I can not, the error message say that "SQL
Server does not exist, or access deny".
The code is the same in ASP.Net application and WinForms application:
==>>
string cnstring = "user id=sa;data source='10.35.3.43';persist security
info=True;initial catalog=MyDB;password='MyPassword'";
string cmdstring = "SELECT Count(*) FROM FunctionCode";
System.Data.SqlClient.SqlConnection cn = new
System.Data.SqlClient.SqlConnection(cnstring);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand(cmdstring, cn);
cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
int count = (int)cmd.ExecuteScalar();
cn.Close();
Response.Write(count.ToString());
<<==
How to fix this problem?
Thanks in advance
KevinRun a profiler trace on the SQL server to see if the login attempt is making
it the the SQL server. This will give you insight in to where to look next
for the problem, network or program.
--
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
> Hi,
> In this case, the environment is:
> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
> 10.35.3.43)
> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
> WinForms application. (In the same subnet)
> In the WinForms application, I can connect to the SQL server sucessfully,
> but in the ASP.Net application, I can not, the error message say that "SQL
> Server does not exist, or access deny".
> The code is the same in ASP.Net application and WinForms application:
> ==>>
> string cnstring = "user id=sa;data source='10.35.3.43';persist security
> info=True;initial catalog=MyDB;password='MyPassword'";
> string cmdstring = "SELECT Count(*) FROM FunctionCode";
> System.Data.SqlClient.SqlConnection cn = new
> System.Data.SqlClient.SqlConnection(cnstring);
> System.Data.SqlClient.SqlCommand cmd = new
> System.Data.SqlClient.SqlCommand(cmdstring, cn);
> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
> int count = (int)cmd.ExecuteScalar();
> cn.Close();
> Response.Write(count.ToString());
> <<==> How to fix this problem?
> Thanks in advance
> Kevin
>|||It's not network problem, I can connect through a WinForm application. I
found something in the following article, I try but still doesn't work.
http://support.microsoft.com/default.aspx?scid=kb;en-us;888228
By the way, the two machines are in different domain.
Regars
Kevin
"Nik Marshall-Blank" <Nik@.Operatelecom.com> дÈëÏûÏ¢ÐÂÎÅ:4iSTe.305886$WN5.7191@.fe02.news.easynews.com...
> Run a profiler trace on the SQL server to see if the login attempt is
> making it the the SQL server. This will give you insight in to where to
> look next for the problem, network or program.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>> Hi,
>> In this case, the environment is:
>> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
>> 10.35.3.43)
>> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
>> WinForms application. (In the same subnet)
>> In the WinForms application, I can connect to the SQL server sucessfully,
>> but in the ASP.Net application, I can not, the error message say that
>> "SQL Server does not exist, or access deny".
>> The code is the same in ASP.Net application and WinForms application:
>> ==>>
>> string cnstring = "user id=sa;data source='10.35.3.43';persist security
>> info=True;initial catalog=MyDB;password='MyPassword'";
>> string cmdstring = "SELECT Count(*) FROM FunctionCode";
>> System.Data.SqlClient.SqlConnection cn = new
>> System.Data.SqlClient.SqlConnection(cnstring);
>> System.Data.SqlClient.SqlCommand cmd = new
>> System.Data.SqlClient.SqlCommand(cmdstring, cn);
>> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
>> int count = (int)cmd.ExecuteScalar();
>> cn.Close();
>> Response.Write(count.ToString());
>> <<==>> How to fix this problem?
>> Thanks in advance
>> Kevin
>>
>|||I would expect that to apply to both connections from Winform and ASP.NET.
Can you perform a profile trace on to see what credentials are being used
for the failing connection.
--
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
> It's not network problem, I can connect through a WinForm application. I
> found something in the following article, I try but still doesn't work.
> http://support.microsoft.com/default.aspx?scid=kb;en-us;888228
> By the way, the two machines are in different domain.
> Regars
> Kevin
>
>
> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
> дÈëÏûÏ¢ÐÂÎÅ:4iSTe.305886$WN5.7191@.fe02.news.easynews.com...
>> Run a profiler trace on the SQL server to see if the login attempt is
>> making it the the SQL server. This will give you insight in to where to
>> look next for the problem, network or program.
>> --
>> Nik Marshall-Blank MCSD/MCDBA
>> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
>> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>> Hi,
>> In this case, the environment is:
>> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
>> 10.35.3.43)
>> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
>> WinForms application. (In the same subnet)
>> In the WinForms application, I can connect to the SQL server
>> sucessfully, but in the ASP.Net application, I can not, the error
>> message say that "SQL Server does not exist, or access deny".
>> The code is the same in ASP.Net application and WinForms application:
>> ==>>
>> string cnstring = "user id=sa;data source='10.35.3.43';persist
>> security info=True;initial catalog=MyDB;password='MyPassword'";
>> string cmdstring = "SELECT Count(*) FROM FunctionCode";
>> System.Data.SqlClient.SqlConnection cn = new
>> System.Data.SqlClient.SqlConnection(cnstring);
>> System.Data.SqlClient.SqlCommand cmd = new
>> System.Data.SqlClient.SqlCommand(cmdstring, cn);
>> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
>> int count = (int)cmd.ExecuteScalar();
>> cn.Close();
>> Response.Write(count.ToString());
>> <<==>> How to fix this problem?
>> Thanks in advance
>> Kevin
>>
>>
>|||Hi, Nik,
I use profile trace, but there is no login or login fail events when using
ASP.Net. There is login even when using WinForm.
The source code and connection string are the same in WinForm and ASP.Net.
"Nik Marshall-Blank" <Nik@.Operatelecom.com> дÈëÏûÏ¢ÐÂÎÅ:XrTTe.308487$kM5.134787@.fe01.news.easynews.com...
>I would expect that to apply to both connections from Winform and ASP.NET.
>Can you perform a profile trace on to see what credentials are being used
>for the failing connection.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
>> It's not network problem, I can connect through a WinForm application. I
>> found something in the following article, I try but still doesn't work.
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;888228
>> By the way, the two machines are in different domain.
>> Regars
>> Kevin
>>
>>
>> "Nik Marshall-Blank" <Nik@.Operatelecom.com> дÈëÏûÏ¢ÐÂÎÅ:4iSTe.305886$WN5.7191@.fe02.news.easynews.com...
>> Run a profiler trace on the SQL server to see if the login attempt is
>> making it the the SQL server. This will give you insight in to where to
>> look next for the problem, network or program.
>> --
>> Nik Marshall-Blank MCSD/MCDBA
>> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
>> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>> Hi,
>> In this case, the environment is:
>> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
>> 10.35.3.43)
>> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
>> WinForms application. (In the same subnet)
>> In the WinForms application, I can connect to the SQL server
>> sucessfully, but in the ASP.Net application, I can not, the error
>> message say that "SQL Server does not exist, or access deny".
>> The code is the same in ASP.Net application and WinForms application:
>> ==>>
>> string cnstring = "user id=sa;data source='10.35.3.43';persist
>> security info=True;initial catalog=MyDB;password='MyPassword'";
>> string cmdstring = "SELECT Count(*) FROM FunctionCode";
>> System.Data.SqlClient.SqlConnection cn = new
>> System.Data.SqlClient.SqlConnection(cnstring);
>> System.Data.SqlClient.SqlCommand cmd = new
>> System.Data.SqlClient.SqlCommand(cmdstring, cn);
>> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
>> int count = (int)cmd.ExecuteScalar();
>> cn.Close();
>> Response.Write(count.ToString());
>> <<==>> How to fix this problem?
>> Thanks in advance
>> Kevin
>>
>>
>>
>|||Ok now we're getting somewhere, not sure where yet but we now going to look
at the ASP.Net server more closely.
But first just try adding the account under which ASP.Net runs as a login on
the SQL Server and see if it connects.
--
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:eYSsLGGtFHA.3908@.tk2msftngp13.phx.gbl...
> Hi, Nik,
> I use profile trace, but there is no login or login fail events when using
> ASP.Net. There is login even when using WinForm.
> The source code and connection string are the same in WinForm and ASP.Net.
>
>
> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
> дÈëÏûÏ¢ÐÂÎÅ:XrTTe.308487$kM5.134787@.fe01.news.easynews.com...
>>I would expect that to apply to both connections from Winform and ASP.NET.
>>Can you perform a profile trace on to see what credentials are being used
>>for the failing connection.
>> --
>> Nik Marshall-Blank MCSD/MCDBA
>> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
>> news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
>> It's not network problem, I can connect through a WinForm application. I
>> found something in the following article, I try but still doesn't work.
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;888228
>> By the way, the two machines are in different domain.
>> Regars
>> Kevin
>>
>>
>> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
>> дÈëÏûÏ¢ÐÂÎÅ:4iSTe.305886$WN5.7191@.fe02.news.easynews.com...
>> Run a profiler trace on the SQL server to see if the login attempt is
>> making it the the SQL server. This will give you insight in to where to
>> look next for the problem, network or program.
>> --
>> Nik Marshall-Blank MCSD/MCDBA
>> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
>> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>> Hi,
>> In this case, the environment is:
>> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
>> 10.35.3.43)
>> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
>> WinForms application. (In the same subnet)
>> In the WinForms application, I can connect to the SQL server
>> sucessfully, but in the ASP.Net application, I can not, the error
>> message say that "SQL Server does not exist, or access deny".
>> The code is the same in ASP.Net application and WinForms application:
>> ==>>
>> string cnstring = "user id=sa;data source='10.35.3.43';persist
>> security info=True;initial catalog=MyDB;password='MyPassword'";
>> string cmdstring = "SELECT Count(*) FROM FunctionCode";
>> System.Data.SqlClient.SqlConnection cn = new
>> System.Data.SqlClient.SqlConnection(cnstring);
>> System.Data.SqlClient.SqlCommand cmd = new
>> System.Data.SqlClient.SqlCommand(cmdstring, cn);
>> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
>> int count = (int)cmd.ExecuteScalar();
>> cn.Close();
>> Response.Write(count.ToString());
>> <<==>> How to fix this problem?
>> Thanks in advance
>> Kevin
>>
>>
>>
>>
>|||I now found the root cause. It's because the Machine A and Machine B are in
different domain, two domains are not trusted. If both machines in the same
domain, it works.
The reason why WinForm app succeeds is because Machine B have stored a use
account and password on Domain A, I could see the NT user name from sql
profiler, it's Domain A's user account.
"Nik Marshall-Blank" <Nik@.Operatelecom.com> дÈëÏûÏ¢ÐÂÎÅ:DEUTe.127980$Lg2.47868@.fe12.news.easynews.com...
> Ok now we're getting somewhere, not sure where yet but we now going to
> look at the ASP.Net server more closely.
> But first just try adding the account under which ASP.Net runs as a login
> on the SQL Server and see if it connects.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:eYSsLGGtFHA.3908@.tk2msftngp13.phx.gbl...
>> Hi, Nik,
>> I use profile trace, but there is no login or login fail events when
>> using ASP.Net. There is login even when using WinForm.
>> The source code and connection string are the same in WinForm and
>> ASP.Net.
>>
>>
>> "Nik Marshall-Blank" <Nik@.Operatelecom.com> дÈëÏûÏ¢ÐÂÎÅ:XrTTe.308487$kM5.134787@.fe01.news.easynews.com...
>>I would expect that to apply to both connections from Winform and
>>ASP.NET. Can you perform a profile trace on to see what credentials are
>>being used for the failing connection.
>> --
>> Nik Marshall-Blank MCSD/MCDBA
>> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
>> news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
>> It's not network problem, I can connect through a WinForm application.
>> I found something in the following article, I try but still doesn't
>> work.
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;888228
>> By the way, the two machines are in different domain.
>> Regars
>> Kevin
>>
>>
>> "Nik Marshall-Blank" <Nik@.Operatelecom.com> дÈëÏûÏ¢ÐÂÎÅ:4iSTe.305886$WN5.7191@.fe02.news.easynews.com...
>> Run a profiler trace on the SQL server to see if the login attempt is
>> making it the the SQL server. This will give you insight in to where
>> to look next for the problem, network or program.
>> --
>> Nik Marshall-Blank MCSD/MCDBA
>> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
>> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>> Hi,
>> In this case, the environment is:
>> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
>> 10.35.3.43)
>> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
>> WinForms application. (In the same subnet)
>> In the WinForms application, I can connect to the SQL server
>> sucessfully, but in the ASP.Net application, I can not, the error
>> message say that "SQL Server does not exist, or access deny".
>> The code is the same in ASP.Net application and WinForms application:
>> ==>>
>> string cnstring = "user id=sa;data source='10.35.3.43';persist
>> security info=True;initial catalog=MyDB;password='MyPassword'";
>> string cmdstring = "SELECT Count(*) FROM FunctionCode";
>> System.Data.SqlClient.SqlConnection cn = new
>> System.Data.SqlClient.SqlConnection(cnstring);
>> System.Data.SqlClient.SqlCommand cmd = new
>> System.Data.SqlClient.SqlCommand(cmdstring, cn);
>> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
>> int count = (int)cmd.ExecuteScalar();
>> cn.Close();
>> Response.Write(count.ToString());
>> <<==>> How to fix this problem?
>> Thanks in advance
>> Kevin
>>
>>
>>
>>
>>
>

Can not access SQL Server

Hi,
In this case, the environment is:
Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address: 10.35.3.43)
Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a WinForms
application. (In the same subnet)
In the WinForms application, I can connect to the SQL server sucessfully,
but in the ASP.Net application, I can not, the error message say that "SQL
Server does not exist, or access deny".
The code is the same in ASP.Net application and WinForms application:
==>>
string cnstring = "user id=sa;data source='10.35.3.43';persist security
info=True;initial catalog=MyDB;password='MyPassword'";
string cmdstring = "SELECT Count(*) FROM FunctionCode";
System.Data.SqlClient.SqlConnection cn = new
System.Data.SqlClient.SqlConnection(cnstring);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand(cmdstring, cn);
cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
int count = (int)cmd.ExecuteScalar();
cn.Close();
Response.Write(count.ToString());
<<==
How to fix this problem?
Thanks in advance
KevinRun a profiler trace on the SQL server to see if the login attempt is making
it the the SQL server. This will give you insight in to where to look next
for the problem, network or program.
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
> Hi,
> In this case, the environment is:
> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
> 10.35.3.43)
> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
> WinForms application. (In the same subnet)
> In the WinForms application, I can connect to the SQL server sucessfully,
> but in the ASP.Net application, I can not, the error message say that "SQL
> Server does not exist, or access deny".
> The code is the same in ASP.Net application and WinForms application:
> ==>>
> string cnstring = "user id=sa;data source='10.35.3.43';persist security
> info=True;initial catalog=MyDB;password='MyPassword'";
> string cmdstring = "SELECT Count(*) FROM FunctionCode";
> System.Data.SqlClient.SqlConnection cn = new
> System.Data.SqlClient.SqlConnection(cnstring);
> System.Data.SqlClient.SqlCommand cmd = new
> System.Data.SqlClient.SqlCommand(cmdstring, cn);
> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
> int count = (int)cmd.ExecuteScalar();
> cn.Close();
> Response.Write(count.ToString());
> <<==
> How to fix this problem?
> Thanks in advance
> Kevin
>|||It's not network problem, I can connect through a WinForm application. I
found something in the following article, I try but still doesn't work.
http://support.microsoft.com/defaul...kb;en-us;888228
By the way, the two machines are in different domain.
Regars
Kevin
"Nik Marshall-Blank" <Nik@.Operatelecom.com> д?:4iSTe.305886$WN5.7191@.fe02.news.eas
ynews.com...
> Run a profiler trace on the SQL server to see if the login attempt is
> making it the the SQL server. This will give you insight in to where to
> look next for the problem, network or program.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>|||I would expect that to apply to both connections from Winform and ASP.NET.
Can you perform a profile trace on to see what credentials are being used
for the failing connection.
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
> It's not network problem, I can connect through a WinForm application. I
> found something in the following article, I try but still doesn't work.
> http://support.microsoft.com/defaul...kb;en-us;888228
> By the way, the two machines are in different domain.
> Regars
> Kevin
>
>
> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
> д?:4iSTe.305886$WN5.7191@.fe02.news.easynews.com...
>|||Hi, Nik,
I use profile trace, but there is no login or login fail events when using
ASP.Net. There is login even when using WinForm.
The source code and connection string are the same in WinForm and ASP.Net.
"Nik Marshall-Blank" <Nik@.Operatelecom.com> д?:XrTTe.308487$kM5.134787@.fe01.news.e
asynews.com...
>I would expect that to apply to both connections from Winform and ASP.NET.
>Can you perform a profile trace on to see what credentials are being used
>for the failing connection.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
>|||Ok now we're getting somewhere, not sure where yet but we now going to look
at the ASP.Net server more closely.
But first just try adding the account under which ASP.Net runs as a login on
the SQL Server and see if it connects.
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:eYSsLGGtFHA.3908@.tk2msftngp13.phx.gbl...
> Hi, Nik,
> I use profile trace, but there is no login or login fail events when using
> ASP.Net. There is login even when using WinForm.
> The source code and connection string are the same in WinForm and ASP.Net.
>
>
> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
> д?:XrTTe.308487$kM5.134787@.fe01.news.easynews.com...
>|||I now found the root cause. It's because the Machine A and Machine B are in
different domain, two domains are not trusted. If both machines in the same
domain, it works.
The reason why WinForm app succeeds is because Machine B have stored a use
account and password on Domain A, I could see the NT user name from sql
profiler, it's Domain A's user account.
"Nik Marshall-Blank" <Nik@.Operatelecom.com> д?:DEUTe.127980$Lg2.47868@.fe12.news.ea
synews.com...
> Ok now we're getting somewhere, not sure where yet but we now going to
> look at the ASP.Net server more closely.
> But first just try adding the account under which ASP.Net runs as a login
> on the SQL Server and see if it connects.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:eYSsLGGtFHA.3908@.tk2msftngp13.phx.gbl...
>

Can not access SQL Server

Hi,
In this case, the environment is:
Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address: 10.35.3.43)
Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a WinForms
application. (In the same subnet)
In the WinForms application, I can connect to the SQL server sucessfully,
but in the ASP.Net application, I can not, the error message say that "SQL
Server does not exist, or access deny".
The code is the same in ASP.Net application and WinForms application:
==>>
string cnstring = "user id=sa;data source='10.35.3.43';persist security
info=True;initial catalog=MyDB;password='MyPassword'";
string cmdstring = "SELECT Count(*) FROM FunctionCode";
System.Data.SqlClient.SqlConnection cn = new
System.Data.SqlClient.SqlConnection(cnstring);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand(cmdstring, cn);
cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
int count = (int)cmd.ExecuteScalar();
cn.Close();
Response.Write(count.ToString());
<<==
How to fix this problem?
Thanks in advance
Kevin
Run a profiler trace on the SQL server to see if the login attempt is making
it the the SQL server. This will give you insight in to where to look next
for the problem, network or program.
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
> Hi,
> In this case, the environment is:
> Machine A: SQL Server 2000 SP3 on Windows 2003 SP1. (IP Address:
> 10.35.3.43)
> Machine B: IIS Server on Windows XP SP2, an ASP.Net application, a
> WinForms application. (In the same subnet)
> In the WinForms application, I can connect to the SQL server sucessfully,
> but in the ASP.Net application, I can not, the error message say that "SQL
> Server does not exist, or access deny".
> The code is the same in ASP.Net application and WinForms application:
> ==>>
> string cnstring = "user id=sa;data source='10.35.3.43';persist security
> info=True;initial catalog=MyDB;password='MyPassword'";
> string cmdstring = "SELECT Count(*) FROM FunctionCode";
> System.Data.SqlClient.SqlConnection cn = new
> System.Data.SqlClient.SqlConnection(cnstring);
> System.Data.SqlClient.SqlCommand cmd = new
> System.Data.SqlClient.SqlCommand(cmdstring, cn);
> cn.Open(); //Suceeds in WinForm, but fails in ASP.Net
> int count = (int)cmd.ExecuteScalar();
> cn.Close();
> Response.Write(count.ToString());
> <<==
> How to fix this problem?
> Thanks in advance
> Kevin
>
|||It's not network problem, I can connect through a WinForm application. I
found something in the following article, I try but still doesn't work.
http://support.microsoft.com/default...b;en-us;888228
By the way, the two machines are in different domain.
Regars
Kevin
"Nik Marshall-Blank" <Nik@.Operatelecom.com> д?:4iSTe.305886$WN5.7191@.fe02.news.easyn ews.com...
> Run a profiler trace on the SQL server to see if the login attempt is
> making it the the SQL server. This will give you insight in to where to
> look next for the problem, network or program.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:%23g6oPUDtFHA.1252@.TK2MSFTNGP09.phx.gbl...
>
|||I would expect that to apply to both connections from Winform and ASP.NET.
Can you perform a profile trace on to see what credentials are being used
for the failing connection.
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
> It's not network problem, I can connect through a WinForm application. I
> found something in the following article, I try but still doesn't work.
> http://support.microsoft.com/default...b;en-us;888228
> By the way, the two machines are in different domain.
> Regars
> Kevin
>
>
> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
> д?:4iSTe.305886$WN5.7191@.fe02.news.easyn ews.com...
>
|||Hi, Nik,
I use profile trace, but there is no login or login fail events when using
ASP.Net. There is login even when using WinForm.
The source code and connection string are the same in WinForm and ASP.Net.
"Nik Marshall-Blank" <Nik@.Operatelecom.com> д?:XrTTe.308487$kM5.134787@.fe01.news.eas ynews.com...
>I would expect that to apply to both connections from Winform and ASP.NET.
>Can you perform a profile trace on to see what credentials are being used
>for the failing connection.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:%237j8zSFtFHA.2792@.tk2msftngp13.phx.gbl...
>
|||Ok now we're getting somewhere, not sure where yet but we now going to look
at the ASP.Net server more closely.
But first just try adding the account under which ASP.Net runs as a login on
the SQL Server and see if it connects.
Nik Marshall-Blank MCSD/MCDBA
"Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
news:eYSsLGGtFHA.3908@.tk2msftngp13.phx.gbl...
> Hi, Nik,
> I use profile trace, but there is no login or login fail events when using
> ASP.Net. There is login even when using WinForm.
> The source code and connection string are the same in WinForm and ASP.Net.
>
>
> "Nik Marshall-Blank" <Nik@.Operatelecom.com>
> д?:XrTTe.308487$kM5.134787@.fe01.news.eas ynews.com...
>
|||I now found the root cause. It's because the Machine A and Machine B are in
different domain, two domains are not trusted. If both machines in the same
domain, it works.
The reason why WinForm app succeeds is because Machine B have stored a use
account and password on Domain A, I could see the NT user name from sql
profiler, it's Domain A's user account.
"Nik Marshall-Blank" <Nik@.Operatelecom.com> д?:DEUTe.127980$Lg2.47868@.fe12.news.easy news.com...
> Ok now we're getting somewhere, not sure where yet but we now going to
> look at the ASP.Net server more closely.
> But first just try adding the account under which ASP.Net runs as a login
> on the SQL Server and see if it connects.
> --
> Nik Marshall-Blank MCSD/MCDBA
> "Kevin Dai" <Kevin_Dzy@.Hotmail.com> wrote in message
> news:eYSsLGGtFHA.3908@.tk2msftngp13.phx.gbl...
>

Saturday, February 25, 2012

Can I use a data field returned from my report as part of the URL address?

I am familiar with the navigation hyperlink action of "Jump to URL" but I cant get it to use the data returned in the report as part of the URL address. When I enter the Url into the expression editor: ="http://internal.company.address/sys1/sys2/caseEdit.pl?case="&"Fields!CaseID.Value" it opens an explorer window but it echos the address and tries to use the text 'Fields!CaseID.Value' instead of the data returned in that field.

Can this be done?

="http://internal.company.address/sys1/sys2/caseEdit.pl?case=" & Fields!CaseID.Value

|||Thanks, this answers my question. Seems so simply once I see the answer.