Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Connecting to a database remotely through VS2005

Reply
Thread Tools

Connecting to a database remotely through VS2005

 
 
axel22@gmail.com
Guest
Posts: n/a
 
      11-13-2006
Ok, I've installed MS Sql Server Express, and I've created a database
'ProbnaBaza' and a table 'clan' in Management Studio. I tried using the
database locally through a project in Visual
Studio. I used the following connection string:

"Server=.\\SQLEXPRESS;Initial Catalog=clan;Integrated Security=SSPI";

It worked perfectly.
Then, I tried using the database by setting an IP address within the
connectionString,
but only to be given an error message:

System.Data.SqlClient.SqlException: An error has occurred while
establishing a connection to the server. When connecting to SQL Server
2005, this failure may be caused by the fact that under the default
settings SQL Server does not allow remote connections. (provider: TCP
Provider, error: 0 - A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond.)

Can anyone help?

Here is my source:

SqlConnection conn = null;

private void Form1_Load(object sender, EventArgs e)
{
conn = new SqlConnection();
conn.ConnectionString = "Data Source=89.172.48.15,1433;" +
"Initial Catalog=clan;Trusted_Connection=False;";
}

private void button1_Click(object sender, EventArgs e)
{
conn.Open();
SqlCommand comm = new SqlCommand("SELECT * FROM clan;",
conn);
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
label1.Text += reader[0].ToString() +
reader[1].ToString()
+ reader[2].ToString() + '\n';
}
conn.Close();
}

 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      11-13-2006
Make sure you have a protocol to connect other than Shared Memory using the
config tool.

You may also have to turn on SQL Browser

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside the box!
*************************************************
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Ok, I've installed MS Sql Server Express, and I've created a database
> 'ProbnaBaza' and a table 'clan' in Management Studio. I tried using the
> database locally through a project in Visual
> Studio. I used the following connection string:
>
> "Server=.\\SQLEXPRESS;Initial Catalog=clan;Integrated Security=SSPI";
>
> It worked perfectly.
> Then, I tried using the database by setting an IP address within the
> connectionString,
> but only to be given an error message:
>
> System.Data.SqlClient.SqlException: An error has occurred while
> establishing a connection to the server. When connecting to SQL Server
> 2005, this failure may be caused by the fact that under the default
> settings SQL Server does not allow remote connections. (provider: TCP
> Provider, error: 0 - A connection attempt failed because the connected
> party did not properly respond after a period of time, or established
> connection failed because connected host has failed to respond.)
>
> Can anyone help?
>
> Here is my source:
>
> SqlConnection conn = null;
>
> private void Form1_Load(object sender, EventArgs e)
> {
> conn = new SqlConnection();
> conn.ConnectionString = "Data Source=89.172.48.15,1433;" +
> "Initial Catalog=clan;Trusted_Connection=False;";
> }
>
> private void button1_Click(object sender, EventArgs e)
> {
> conn.Open();
> SqlCommand comm = new SqlCommand("SELECT * FROM clan;",
> conn);
> SqlDataReader reader = comm.ExecuteReader();
> while (reader.Read())
> {
> label1.Text += reader[0].ToString() +
> reader[1].ToString()
> + reader[2].ToString() + '\n';
> }
> conn.Close();
> }
>



 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      11-13-2006
by default sqlexpress does not allow tcp/ip connects, only local shared
pipes.

-- bruce (sqlwork.com)


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Ok, I've installed MS Sql Server Express, and I've created a database
> 'ProbnaBaza' and a table 'clan' in Management Studio. I tried using the
> database locally through a project in Visual
> Studio. I used the following connection string:
>
> "Server=.\\SQLEXPRESS;Initial Catalog=clan;Integrated Security=SSPI";
>
> It worked perfectly.
> Then, I tried using the database by setting an IP address within the
> connectionString,
> but only to be given an error message:
>
> System.Data.SqlClient.SqlException: An error has occurred while
> establishing a connection to the server. When connecting to SQL Server
> 2005, this failure may be caused by the fact that under the default
> settings SQL Server does not allow remote connections. (provider: TCP
> Provider, error: 0 - A connection attempt failed because the connected
> party did not properly respond after a period of time, or established
> connection failed because connected host has failed to respond.)
>
> Can anyone help?
>
> Here is my source:
>
> SqlConnection conn = null;
>
> private void Form1_Load(object sender, EventArgs e)
> {
> conn = new SqlConnection();
> conn.ConnectionString = "Data Source=89.172.48.15,1433;" +
> "Initial Catalog=clan;Trusted_Connection=False;";
> }
>
> private void button1_Click(object sender, EventArgs e)
> {
> conn.Open();
> SqlCommand comm = new SqlCommand("SELECT * FROM clan;",
> conn);
> SqlDataReader reader = comm.ExecuteReader();
> while (reader.Read())
> {
> label1.Text += reader[0].ToString() +
> reader[1].ToString()
> + reader[2].ToString() + '\n';
> }
> conn.Close();
> }
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      11-13-2006
Please follow the procedure outlined here :
http://support.microsoft.com/default...b;EN-US;914277

Doing that will fix your problem.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espanol : http://asp.net.do/foros/
===================================
<(E-Mail Removed)> wrote in message news:(E-Mail Removed) oups.com...
> Ok, I've installed MS Sql Server Express, and I've created a database
> 'ProbnaBaza' and a table 'clan' in Management Studio. I tried using the
> database locally through a project in Visual
> Studio. I used the following connection string:
>
> "Server=.\\SQLEXPRESS;Initial Catalog=clan;Integrated Security=SSPI";
>
> It worked perfectly.
> Then, I tried using the database by setting an IP address within the
> connectionString,
> but only to be given an error message:
>
> System.Data.SqlClient.SqlException: An error has occurred while
> establishing a connection to the server. When connecting to SQL Server
> 2005, this failure may be caused by the fact that under the default
> settings SQL Server does not allow remote connections. (provider: TCP
> Provider, error: 0 - A connection attempt failed because the connected
> party did not properly respond after a period of time, or established
> connection failed because connected host has failed to respond.)
>
> Can anyone help?
>
> Here is my source:
>
> SqlConnection conn = null;
>
> private void Form1_Load(object sender, EventArgs e)
> {
> conn = new SqlConnection();
> conn.ConnectionString = "Data Source=89.172.48.15,1433;" +
> "Initial Catalog=clan;Trusted_Connection=False;";
> }
>
> private void button1_Click(object sender, EventArgs e)
> {
> conn.Open();
> SqlCommand comm = new SqlCommand("SELECT * FROM clan;",
> conn);
> SqlDataReader reader = comm.ExecuteReader();
> while (reader.Read())
> {
> label1.Text += reader[0].ToString() +
> reader[1].ToString()
> + reader[2].ToString() + '\n';
> }
> conn.Close();
> }
>



 
Reply With Quote
 
axel22@gmail.com
Guest
Posts: n/a
 
      11-14-2006
Already enabled shared memory and named pipes.

As for the link, thnx, i'll look into it!


Juan T. Llibre je napisao/la:
> Please follow the procedure outlined here :
> http://support.microsoft.com/default...b;EN-US;914277
>
> Doing that will fix your problem.
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espanol : http://asp.net.do/foros/
> ===================================
> <(E-Mail Removed)> wrote in message news:(E-Mail Removed) oups.com...
> > Ok, I've installed MS Sql Server Express, and I've created a database
> > 'ProbnaBaza' and a table 'clan' in Management Studio. I tried using the
> > database locally through a project in Visual
> > Studio. I used the following connection string:
> >
> > "Server=.\\SQLEXPRESS;Initial Catalog=clan;Integrated Security=SSPI";
> >
> > It worked perfectly.
> > Then, I tried using the database by setting an IP address within the
> > connectionString,
> > but only to be given an error message:
> >
> > System.Data.SqlClient.SqlException: An error has occurred while
> > establishing a connection to the server. When connecting to SQL Server
> > 2005, this failure may be caused by the fact that under the default
> > settings SQL Server does not allow remote connections. (provider: TCP
> > Provider, error: 0 - A connection attempt failed because the connected
> > party did not properly respond after a period of time, or established
> > connection failed because connected host has failed to respond.)
> >
> > Can anyone help?
> >
> > Here is my source:
> >
> > SqlConnection conn = null;
> >
> > private void Form1_Load(object sender, EventArgs e)
> > {
> > conn = new SqlConnection();
> > conn.ConnectionString = "Data Source=89.172.48.15,1433;" +
> > "Initial Catalog=clan;Trusted_Connection=False;";
> > }
> >
> > private void button1_Click(object sender, EventArgs e)
> > {
> > conn.Open();
> > SqlCommand comm = new SqlCommand("SELECT * FROM clan;",
> > conn);
> > SqlDataReader reader = comm.ExecuteReader();
> > while (reader.Read())
> > {
> > label1.Text += reader[0].ToString() +
> > reader[1].ToString()
> > + reader[2].ToString() + '\n';
> > }
> > conn.Close();
> > }
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Using Python and Connecting to MySQL remotely WITHOUT MySQL installedon local computer dave Python 4 11-18-2010 04:19 AM
VS2005 connecting to database SE.Computerguy ASP .Net 0 10-29-2007 07:31 PM
Grant Administrative Rights Remotely through ASP.NET =?Utf-8?B?Um9ja3k=?= ASP .Net 0 12-20-2005 08:45 PM



Advertisments