I am using VS2005 and SQL 2005. I am developping an application that has to
connect to a database at SQL 2K5. I am using the emulator to test it. When
the application try to connect to the database, it gives me an exception
(SqlException). This is the code I am using to connect to it, what is wrong?
SqlConnection conn = new SqlConnection("Data Source=SERVER01;Initial
Catalog=ToliWWW;User ID=sa");

SqlDataAdapter Adp = new SqlDataAdapter();

Adp.SelectCommand = new SqlCommand("Select * from Table1", conn);

DataSet DS = new DataSet();

conn.Open();

Adp.Fill(DS, "Table1");

dataGrid1.DataSource = DS;

conn.Close();

Re: Connect to SQL2K5 by okonovalenko

okonovalenko
Wed Dec 14 08:40:10 CST 2005

What is the SqlException msg says?
try this and get a msg


try
{
SqlConnection conn = new SqlConnection("Data Source=SERVER01;Initial
Catalog=ToliWWW;User ID=sa");
SqlDataAdapter Adp = new SqlDataAdapter("Select * from Table1", conn);

DataSet DS = new DataSet();
DataTable tb = new DataTable("Table1");
DS.Tables.Add(tb);

conn.Open();
Adp.Fill(DS, "Table1");
dataGrid1.DataSource = DS.Tables["Table1"];
conn.Close();

}catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}


Re: Connect to SQL2K5 by Claudio

Claudio
Wed Dec 14 10:07:54 CST 2005

The message is ESPECIFIED SQL SERVER NOT FOUND SERVER01

<okonovalenko@gmail.com> escreveu na mensagem
news:1134571210.486510.176160@g44g2000cwa.googlegroups.com...
> What is the SqlException msg says?
> try this and get a msg
>
>
> try
> {
> SqlConnection conn = new SqlConnection("Data Source=SERVER01;Initial
> Catalog=ToliWWW;User ID=sa");
> SqlDataAdapter Adp = new SqlDataAdapter("Select * from Table1", conn);
>
> DataSet DS = new DataSet();
> DataTable tb = new DataTable("Table1");
> DS.Tables.Add(tb);
>
> conn.Open();
> Adp.Fill(DS, "Table1");
> dataGrid1.DataSource = DS.Tables["Table1"];
> conn.Close();
>
> }catch(SqlException ex)
> {
> MessageBox.Show(ex.Message);
> }
>



Re: Connect to SQL2K5 by okonovalenko

okonovalenko
Wed Dec 14 10:58:28 CST 2005

Here you go... the problem is in connection string, if you are using
SQL2005 Express then try this
"SERVER=Computer's name\SQLEXPRESS;"
or
"SERVER=Computer's name\SERVER01;"

2. Check if you can see the network on the Emulator by connecting to
another computer, it might ask you to change default PocketPC name


Re: Connect to SQL2K5 by Claudio

Claudio
Wed Dec 14 12:00:57 CST 2005

I really can not see others computers. When I try to connect to \\SERVER01
it says that the network path was not found.

<okonovalenko@gmail.com> escreveu na mensagem
news:1134579508.098466.283150@g43g2000cwa.googlegroups.com...
> Here you go... the problem is in connection string, if you are using
> SQL2005 Express then try this
> "SERVER=Computer's name\SQLEXPRESS;"
> or
> "SERVER=Computer's name\SERVER01;"
>
> 2. Check if you can see the network on the Emulator by connecting to
> another computer, it might ask you to change default PocketPC name
>



Re: Connect to SQL2K5 by Claudio

Claudio
Wed Dec 14 13:41:46 CST 2005

What are the ways to connect the emulator to my network?

"Claudio Diginet" <claudio@digi.com.br> escreveu na mensagem
news:%23dm18nLAGHA.272@TK2MSFTNGP09.phx.gbl...
>I am using VS2005 and SQL 2005. I am developping an application that has
>to connect to a database at SQL 2K5. I am using the emulator to test it.
>When the application try to connect to the database, it gives me an
>exception (SqlException). This is the code I am using to connect to it,
>what is wrong?
> SqlConnection conn = new SqlConnection("Data Source=SERVER01;Initial
> Catalog=ToliWWW;User ID=sa");
>
> SqlDataAdapter Adp = new SqlDataAdapter();
>
> Adp.SelectCommand = new SqlCommand("Select * from Table1", conn);
>
> DataSet DS = new DataSet();
>
> conn.Open();
>
> Adp.Fill(DS, "Table1");
>
> dataGrid1.DataSource = DS;
>
> conn.Close();
>
>



Re: Connect to SQL2K5 by Arrow

Arrow
Wed Dec 14 15:51:40 CST 2005


try using the ip/port number ...i couldn't connect unless i did this

"Claudio Diginet" <claudio@digi.com.br> wrote in message
news:OkdwahNAGHA.1600@TK2MSFTNGP11.phx.gbl...
>I really can not see others computers. When I try to connect to \\SERVER01
>it says that the network path was not found.
>
> <okonovalenko@gmail.com> escreveu na mensagem
> news:1134579508.098466.283150@g43g2000cwa.googlegroups.com...
>> Here you go... the problem is in connection string, if you are using
>> SQL2005 Express then try this
>> "SERVER=Computer's name\SQLEXPRESS;"
>> or
>> "SERVER=Computer's name\SERVER01;"
>>
>> 2. Check if you can see the network on the Emulator by connecting to
>> another computer, it might ask you to change default PocketPC name
>>
>
>