I need to connect to SQL Server 2005 from Windows CE 5.0.
My code is the following:
SqlConnection conexao = new SqlConnection();
try
{
string strConn = "Data Source=192.168.73.149,1433;Initial
Catalog=Amend;user id=sa;password=Trix2009!;";
conexao.ConnectionString = strConn;
conexao.Open();
string query = "SELECT * FROM Produto";
SqlCommand comando = new SqlCommand(query);
SqlDataReader reader = comando.ExecuteReader();
while (reader.Read())
{
MessageBox.Show(reader["Produto"].ToString());
}
reader.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conexao.Close();
}
It throws an exception telling just SQLException.
I don't know what occurs.
Thanks.
Paul T.