Well coming to my issue
I planned to test my connection using " State " member of connection class . so i have written
Logic :
Declarations: using System.Data.OleDb;
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("provider=SqlOleDb;Integrated Security =SSPI;Database=Master");
con.Open();
MessageBox.Show(con.State.ToString());
con.Close();
MessageBox.Show(con.State.ToString());
}
under button when i click it i should tell me the status of connection :)
But i am facing errors like : Invalid authorization specification
Invalid connection string attribute
some other time :[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
I installed SQL server 2008 on my local machine :)
Any ideas about this :)
Thank you

VulpesPosted Feb 26, 2013, 3:42 PM
http://www.connectionstrings.com/sql-server-2008#net-framework-data-provider-for-ole-db
SUNIL GUTTAPosted Mar 1, 2013, 3:27 AM
Here goes the answer for my silly query :)
Error i discussed : A network-related or instance-specific error occurred while establishing a connection to SQL Server.
Remedy: OleDbConnection con = new OleDbConnection("provider=SqlOleDb;Integrated Security =SSPI;Database=Master;Data Source=LION-PC//sunilserver");
Note: ACTUALLY i used single back slash but as single '/' not supported as u know lol i don't know that when used '//' works fine like above & must mention data source name it can't be optional although it local sys :)
Instance error occurs jut becoz when we install visual studio first later sql server 2008 it will cause some trouble shooting problems like this :) like this this bug fixed
Thank you very much to my Sir clarified in one shot :)
SUNIL GUTTAPosted Feb 28, 2013, 7:57 AM
I'M confused Are saying about configuration files :) i am beginner in connection string so can you please be more elobarate :(
Sorry to insist you & plz
SUNIL GUTTAPosted Feb 28, 2013, 7:55 AM
Rimi JainPosted Feb 28, 2013, 7:36 AM
Remove "Integrated Security=True" and try again.
Rimi
Prabhakar ReddyPosted Feb 28, 2013, 7:33 AM
add db path on web.config
Ex:
web.config:
Call that connection string on webpage
SqlConnection con=NewSqlConnection(ConfigurationManager.ConnectionStrings("NewsDBConnectionString").ConnectionString)
SUNIL GUTTAPosted Feb 28, 2013, 7:27 AM
As you said i tried already dude . check above connection string mentioned local database name only .. is there any corrections i need to do ? i am getting same error as mentioned above
Prabhakar ReddyPosted Feb 28, 2013, 1:09 AM
i understood ur problem,
the problem is very simple, you just upload ur database to server and give server path to there, right now u gave local path (i think SunilDB is local database path).
** change ur database path appropriately means if u r runing locally give local path otherwise give server path.
SUNIL GUTTAPosted Feb 27, 2013, 3:59 AM
I have tried using sql client but i am getting diff diff error's
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
what to do ? server is not recognized :(
i used : using System.Data.SqlClient;
SqlConnection con = new SqlConnection("Integrated Security=True;Database=SunilDB");
In Sql server configuration manager logged in with windows authentication & made SQL SERVER BROWSER ,sql integration services& SQL SERVER(SUNIL SERVER) running :) remaining all stopped not able to start also them :( checked all pipes made them enable :)
Plz help me out .
But this is when i removed con.open() in above program then i am getting output like 2 message boxes saying connection closed .
Thank you