Re: Unable to Connect To Sql Server 2000 using .NET 2005 EXPRESS

Tech-Archive recommends: Speed Up your PC by fixing your registry



Check www.connectionstrings.com and see if your connection string is valid.

Robin S.
--------------------
"Terrance" <Terrance@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:23B708A9-5C18-4698-8D2D-97961C12050B@xxxxxxxxxxxxxxxx
Can anyone help me with an issue. I have a .net app that tries to connect
to
my sql server here on my laptop on my company's network. When I have
someone
on the network try the app they get the following message in the
errorlog:
*Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding*

I tried connecting through IP and machine name but no success. My Sql
Server
agent and Sql Server is running. I can access the data fine locally of
course. Here is the connection string:

private string connstring = "pwd=<password>;uid=<username>;" +
"database=projectMgr;server=<machinename>";

Here is what I'm using when the user tries to login:

cmd.CommandType = CommandType.Text;
cmd.Connection = sconn;
cmd.CommandText = "SELECT username, upassword, rights FROM
" +
"usertable WHERE username = @username AND upassword =
@upassword";
cmd.CommandTimeout = 30000;

SqlParameter sparam = new SqlParameter();
sparam = cmd.Parameters.AddWithValue("@username", user);
sparam.DbType = DbType.String;
sparam.Direction = ParameterDirection.Input;

sparam = cmd.Parameters.AddWithValue("@upassword",
upassword);
sparam.DbType = DbType.String;
sparam.Direction = ParameterDirection.Input;
sconn.Open();

mAdapter.SelectCommand = cmd;
mAdapter.Fill(myDataTable);

if (myDataTable.Rows.Count > 0)
{
mFlag = true;
appObject.uClass.urights =
myDataTable.Rows[0]["rights"].ToString();
}
else
{
mFlag = false;
}

I using the timeout method but it's not helping.
--
TC


.



Relevant Pages

  • Re: SQL Server security exception
    ... but the SQL server is on the ... This is very strange because I'm using the same Connection String ... > | public SqlConnection SqlConn = new SqlConnection; ... > Do you happen to run this from a network drive? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: One Connection String for Multiple Users (SQL)
    ... Hitchhiker’s Guide to Visual Studio and SQL Server ... "William Vaughn" wrote: ... This uses the> same connection string for all instances of the application. ...
    (microsoft.public.sqlserver.connect)
  • Re: XMLBulkload fails in asp.net com interop but works in vb.net
    ... Is it possible that your asp.net process is running under the NETWORK ... If you webserver and sql server are on different boxes, ... >> There is something wrong with your connection string. ...
    (microsoft.public.sqlserver.xml)
  • Re: web service for accessing db?
    ... Plus I have connection string embeded in to code. ... All client are within the network or accesing network through VPN. ... be in using web service, I don't see benefits at all. ... malicious user can read its content and connect to sql server directly. ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: How do I configure Analysis Services for Excel 2003 users?
    ... they had had Office 2003 installed AFTER SQL Server. ... > I have been preparing a set of cubes in Analysis Services 2005 to be viewed ... > Excel reports have been designed as pivot tables based on AS cubes, ... > Surely it must be that the connection string is incorrect but I seem to have ...
    (microsoft.public.sqlserver.olap)