[Mono-devel-list] ASP.NET and SQL SERVER 2000

Michael J. Ryan tracker1_lists at theroughnecks.com
Wed Sep 22 01:32:51 EDT 2004


Suggest it is an issue with the connection string, is MyServer resolving,
does it allow for tcp access on the default port (1433) from your client IP
address.. change MyServer to the IP, try telnetting in from the client on
port 1433 to see if you can connect.. is the username/password a windows
username/password, or an sql user.. if it is a windows user, you should
allow for dual (windows and sql) authentication, and create the user on
the database itself.

falconn at free.fr wrote:
> Hi !
> 
> I've a strange problem with mono. I want to get informations from a database
> under SQL SERVER. I tried the following example taken from the MonoHandbook
> doing some modifications.
> But when I run it, sometimes it's working, sometimes not : it shows an error
> message (something like it can't find the sql server or I don't have access to
> the database). I tried to use unixODBC with freetds and it works, but it's a
> little bit slow! So it doesn't seem to be a problem with my SQL Server. Is it a
> bug?
> 
> 
> 
> Here is the code I use :
> 
> using System;
> using System.Data;
> using System.Data.SqlClient;
> 
>  public class Test
>  {
>     public static void Main(string[] args)
>     {
>   string connectionString =
>      "Server=MyServer;" +
>      "Database=pubs;" +
>      "User ID=MySqlServerUserId;" +
>      "Password=MySqlServerPassword;";
>   IDbConnection dbcon;
>   dbcon = new SqlConnection(connectionString);
>   dbcon.Open();
>   IDbCommand dbcmd = dbcon.CreateCommand();
>   string sql =
>       "SELECT fname, lname " +
>       "FROM employee";
>   dbcmd.CommandText = sql;
>   IDataReader reader = dbcmd.ExecuteReader();
>   while(reader.Read()) {
>   string FirstName = (string) reader["fname"];
>   string LastName = (string) reader["lname"];
>   Console.WriteLine("Name: " +
>        FirstName + " " + LastName);
>   }
>   // clean up
>   reader.Close();
>   reader = null;
>   dbcmd.Dispose();
>   dbcmd = null;
>   dbcon.Close();
>   dbcon = null;
>     }
>  }
> 
> 
> Here is the error message when it doesn't work :
> 
> mono testing.exe
> 
> Unhandled Exception: System.Data.SqlClient.SqlException: SQL Server does not
> exist or access denied.
> in <0x0020e> System.Data.SqlClient.SqlConnection:Open ()
> in <0x00066> Test:Main (string[])
> 
> zsh: exit 1     mono testing.exe
> 
> I have tested the connexion with SQLSharp and the problem remains the same...
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-- 
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386  -  AIM/AOL: azTracker1  -  Y!: azTracker1  -  MSN/Win: (email)



More information about the Mono-devel-list mailing list