Click here to Skip to main content
15,886,654 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi ,
this is my connection string :

C#
string strConnection = "Data Source=PROGRAMCO-PC,1433;Initial Catalog=test;User ID=sa;Password=;";
string strCommand = "Select * from tblMosh";
SqlConnection connDB = new SqlConnection(strConnection);
connDB.Open();


tcp/ip in sql server configuration manager is enable!

error :

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Connect(String host, SqlInternalConnection connHandler, Int32 timeout)
at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, Hashtable connectionOptions)
at System.Data.SqlClient.SqlConnection.Open()
at SmartDeviceProject1.Form1.fillGrid()
at SmartDeviceProject1.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.Run(Form fm)
at SmartDeviceProject1.Program.Main()
Posted
Comments
kennytan_ph 16-Aug-11 2:39am    
are you running on device emulator?

1 solution

if you are connecting remotely you have first to make the authentication to mixed authentication , and is your server you are connecting locally ? it is more accurate if you apply the IP,port and then you can ping to that IP and see the result.. and also try connecting by applying the same data using the EMS .
there are many cases to cuase such error so you have to make double check on your firewall , IP ping, all services are enabled. and sometimes sorry for that silly issue such as check the wireless or GPRS if working on the device.

regards..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900