[Mono-devel-list] ASP.NET and SQL SERVER 2000
Rafael Teixeira
monoman at gmail.com
Tue Sep 21 10:22:19 EDT 2004
Also check if SQL Server is configured to accept SQL Logins, not
Integrated Windows Logins (Active Directory).
Hope it helps,
On Tue, 21 Sep 2004 12:57:51 +0100, rus <rus at forgecom.co.uk> wrote:
> The clue may be in the error message..
>
> The login details are correct?
> The server name's correct?
> The database name's correct?
> The SQL server is allowing connections from the machine running mono?
>
> I've definatly had mono on linux talking to SQL server on windows before
> using SqlClient
>
>
>
> On Tue, 2004-09-21 at 12:34, 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
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
--
Rafael "Monoman" Teixeira
---------------------------------------
"Eu poderia suportar, embora não sem dor, que tivessem
ido todos os meus amores, mas enlouqueceria se perdesse
todos os meus amigos!
A alguns deles não procuro, basta-me saber que eles existem.
Esta mera condição me encoraja a seguir em frente pela vida....
mas é delicioso que eu saiba e sinta que os adoro,
embora não declare e não os procure sempre".
Vinicius de Moraes - O "Poetinha"
My bad translation:
"I could survive, not without pain, that all my lovers
would disappear, but would be driven crazy if
I had lost all my friends!
Some I don't even have to reach, I just need to know that they exist.
This mere condition makes me brave enough to go ahead with my life...
but it is sweet that I know and feel that I love them,
even if I don't state it openly and reach for them always."
Vinicius de Moraes - Brazilian Poet
More information about the Mono-devel-list
mailing list