SQLConnection with C# in ASP.net
Posted on 2006-06-08
I'm having some problems connecting to my datasource within a C# script in ASP.net.
I have the following commands:
SqlConnection conn = new SqlConnection("Data Source=localhost; database=mydatabase; uid=sa; pwd=thepassword; connection timeout = 10");
It gives an error saying the connection could not be made. Warning that the server might not allow remote connections.
My questions are these:
1) Can I use ODBC to connect?
2) I'm running SQL Server 2000 (that's where the database is), but the machine had the SQL2005Express installed before I installed SQL 2000.
3) On a C# Windows Form, I've been able to add a sqlconnection in from the toolbox, configure it and get it to work. But this is NOT availble in my toolbox when writing web pages. Is this true?
4) How do I get my syntax to work?