Hello everybody,
Oh man, I've been focused in trying to find a solution to my connection problem.
Well, I'll post the code once again along with the new error message I get when I run it.
Last updated code:
SqlConnection
objConn; SqlCommand objCmd; SqlDataReader objRdr;objConn =
new SqlConnection("Server=SQLLOCAL;Database=Dorknozzle;Integrated Security=true");objCmd =
new SqlCommand("Select * From Employees", objConn);objConn.Open();
objRdr = objCmd.ExecuteReader();
while (objRdr.Read()){
Response.Write(objRdr[
"Name"] + "");
}
objRdr.Close();
objConn.Close();
Error Message:
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. "
Now, I have researched the SQL remote issue and I have found a website that show me how to change these settings, this is the link: http://www.programmingado.net/a-395/SQL-Server-2005-Express-and-remote-connection.aspx
Well, at this point I really don't know what I'm looking for, I also tried the following code:
SqlConnectionStringBuilder bu = new SqlConnectionStringBuilder();bu.DataSource =
@"OFFICE\SQLLOCAL"; //Where the OFFICE is the computer name and SQLLOCAL is the instance ... How can I know this settings, where are they located?bu.InitialCatalog = /////// I just don't know what goes here. A member of the forum told me to put the database, but it does not work.
bu.IntegratedSecurity =
true; SqlConnection conn = new SqlConnection();conn.ConnectionString = bu.ConnectionString;
conn.Open();
objCmd =
new SqlCommand("Select * From Employees", objConn);objRdr = objCmd.ExecuteReader();
while (objRdr.Read()){
Response.Write(objRdr[
"Name"] + "");
}
If someone can help me, I would greatly appreciate it.
Thanks,
Eduardo
Eduardo
Eduardo AriasPosted Feb 5, 2008, 8:09 AM
Kapil Deo MalhotraPosted Feb 4, 2008, 12:15 PM
objConn = new SqlConnection("Server
=SQLLOCAL;Database
=Dorknozzle;Integrated Security=true");
can you give server=local or server=(local) and try. please let me know how it went
Eduardo AriasPosted Jan 28, 2008, 9:08 AM
Scott BradyPosted Jan 28, 2008, 5:13 AM
Did you try the instructions outlined in the link that you posted?
Regards
ScottyB