Friday, March 30, 2012
more mystery on (local) vs localhost
There are known issues and bugs filed against the use of 'localhost'.
You should always use '(local)' in your connection string.
Is there any specific reason to use '(local)' instead of 'localhost'?
Thanks in advance,
PI
PING PING !!!
ipramod@.gmail.com wrote:
> Hi,
> There are known issues and bugs filed against the use of 'localhost'.
> You should always use '(local)' in your connection string.
> Is there any specific reason to use '(local)' instead of 'localhost'?
> Thanks in advance,
> PI
more mystery on (local) vs localhost
connectionString = "server=localhost;uid=sa;pwd=;database=pubs;"
FAILS
connectionString= "server=(local);uid=sa;pwd=;database=pubs;"
WORKS
C:\>osql -U sa -S localhost FAILS
Password:
[DBNETLIB]General network error. Check your network documentation.
[DBNETLIB]ConnectionRead (recv()).
C:\>isql -U sa -S localhost WORKS
Password:
1>
>
> ping localhost WORKS FINE
> connectionString = "server=localhost;uid=sa;pwd=;database=pubs;"
> FAILS
> connectionString= "server=(local);uid=sa;pwd=;database=pubs;"
> WORKS
> C:\>osql -U sa -S localhost FAILS
> Password:
> [DBNETLIB]General network error. Check your network documentation.
> [DBNETLIB]ConnectionRead (recv()).
> C:\>isql -U sa -S localhost WORKS
> Password:
> 1>
There are known issues and bugs filed against the use of 'localhost'.
You should always use '(local)' in your connection string.
Hope this helps,
Eric Crdenas
SQL Server senior support professional
sql
more mystery on (local) vs localhost
connectionString = "server=localhost;uid=sa;pwd=;database=pubs;"
FAILS
connectionString= "server=(local);uid=sa;pwd=;database=pubs;"
WORKS
C:\>osql -U sa -S localhost FAILS
Password:
[DBNETLIB]General network error. Check your network documentation.
[DBNETLIB]ConnectionRead (recv()).
C:\>isql -U sa -S localhost WORKS
Password:
1>>
> ping localhost WORKS FINE
> connectionString = "server=localhost;uid=sa;pwd=;database=pubs;"
> FAILS
> connectionString= "server=(local);uid=sa;pwd=;database=pubs;"
> WORKS
> C:\>osql -U sa -S localhost FAILS
> Password:
> [DBNETLIB]General network error. Check your network documentation.
> [DBNETLIB]ConnectionRead (recv()).
> C:\>isql -U sa -S localhost WORKS
> Password:
> 1>
--
There are known issues and bugs filed against the use of 'localhost'.
You should always use '(local)' in your connection string.
Hope this helps,
--
Eric Cárdenas
SQL Server senior support professional
more mystery on (local) vs localhost
connectionString = " server=localhost;uid=sa;pwd=;database=pu
bs;"
FAILS
connectionString= " server=(local);uid=sa;pwd=;database=pubs
;"
WORKS
C:\>osql -U sa -S localhost FAILS
Password:
[DBNETLIB]General network error. Check your network documentation.
[DBNETLIB]ConnectionRead (recv()).
C:\>isql -U sa -S localhost WORKS
Password:
1>>
> ping localhost WORKS FINE
> connectionString = " server=localhost;uid=sa;pwd=;database=pu
bs;"
> FAILS
> connectionString= " server=(local);uid=sa;pwd=;database=pubs
;"
> WORKS
> C:\>osql -U sa -S localhost FAILS
> Password:
> [DBNETLIB]General network error. Check your network documentation.
> [DBNETLIB]ConnectionRead (recv()).
> C:\>isql -U sa -S localhost WORKS
> Password:
> 1>
--
There are known issues and bugs filed against the use of 'localhost'.
You should always use '(local)' in your connection string.
Hope this helps,
Eric Crdenas
SQL Server senior support professional
more mystery on (local) vs localhost
There are known issues and bugs filed against the use of 'localhost'.
You should always use '(local)' in your connection string.
Is there any specific reason to use '(local)' instead of 'localhost'?
Thanks in advance,
PIPING PING !!!
ipramod@.gmail.com wrote:
> Hi,
> There are known issues and bugs filed against the use of 'localhost'.
> You should always use '(local)' in your connection string.
> Is there any specific reason to use '(local)' instead of 'localhost'?
> Thanks in advance,
> PI
more mystery on (local) vs localhost
There are known issues and bugs filed against the use of 'localhost'.
You should always use '(local)' in your connection string.
Is there any specific reason to use '(local)' instead of 'localhost'?
Thanks in advance,
PIPING PING !!!
ipramod@.gmail.com wrote:
> Hi,
> There are known issues and bugs filed against the use of 'localhost'.
> You should always use '(local)' in your connection string.
> Is there any specific reason to use '(local)' instead of 'localhost'?
> Thanks in advance,
> PI
Monday, February 20, 2012
Money format error
I use asp.net 2.0 and sql server 2005 for a web site (and Microsoft enterprise library).When I run aplication at local there is no problem but at the server I take this error:
Disallowed implicit conversion from data type varchar to data type money, table 'dbname.dbo.shopProducts', column 'productPrice'. Use the CONVERT function to run this query.
productPrice coloumn format is money. It was working correctly my old server but now it crashed.How can I solve this problem? And why it isn't work same configuration?
My code:
decimal productPrice;
Database db =DatabaseFactory.CreateDatabase("connection");
string sqlCommand ="update shopProducts set .................,productPrice='" + productPrice.ToString().Replace(",",".") +"',................where productID=" + productID +" ";
db.ExecuteNonQuery(CommandType.Text, sqlCommand)
Decimal should be able to covert to SqlMoney implicitly, why you convert the price to string before update it to the table? However, it's better to useParameterized Queries as possible as you can.