المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : a strange problem with windows service



C# Programming
07-24-2009, 12:52 PM
this question is a mixture of sql and c# windows services...
i have a windows service which connects to COM1 port(serial port) and writes the data into a sql db. i have an installer which installs the service and run it immidiatly after setup is completed , but stops very soon because of this error which appears in event log :
provide : named pipes provider . error 40 - could not connect to sql server
i have installed sql server 2005 (not express ed) and the connection string
in my service is :
http://www.barakasoft.com/script/Forums/Images/smiley_confused.gif
string _connectionstring =
"server=" + Environment.MachineName +";Initial Catalog=myDatabase;"+
"user id=myLogin;password=myPassword;trusted_connection = true;";

i have tested this connection string in a simple windows form and it works!
please notice that this sql server and windows service are working on local computer , not a network. http://www.barakasoft.com/script/Forums/Images/smiley_OMG.gif