Error Coming while Loading DataSet

Topics: Data Access Application Block
Sep 24, 2008 at 7:16 AM
Edited Sep 24, 2008 at 7:20 AM
Hi all
i have installed Enterprise Library 4 recently to use Data Access Application Block. i m facing following error while i load data set:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
 Here is my Code:

Database

db = DatabaseFactory.CreateDatabase("Ideagate");
DbCommand com = db.GetSqlStringCommand("select * from TB_Lookup_SystemSetup_Levels");

 

DataSet ds = new DataSet();
db.LoadDataSet(com, ds,
"TB_Lookup_SystemSetup_Levels");  <<Here i m facing the above error 
DataTable tb = ds.Tables[0];

if i do manually ,means without using EL, then there is no problem:

 

 

string connectiongstring = "server=(local);database=IdeaGate;integrated security=true;";

 

 

string cm = "select * from TB_Lookup_SystemSetup_Levels";

 

 

SqlConnection con = new SqlConnection(connectiongstring);

 

 

SqlCommand com1 = new SqlCommand(cm, con);

 

 con.Open();

 

SqlDataReader reader = com1.ExecuteReader();

 

 

if (reader.Read())

 

 {

 

}

reader.Close();

con.Close();

 

 

Sep 25, 2008 at 9:34 AM
now its working. actully there was some problem in Connections string. I didnt set Data Source Properly