Reputation: 1
I get that error when I try to debug my program. Searched for this error but could not really figure it out on my own. Also when I try to connect my database I get this error "error: 26 - Error Locating Server/Instance Specified
".
public DataTable ReadData(string st_proc, SqlParameter[] param)
{
SqlCommand command = new SqlCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = st_proc;
command.Connection = conn;
if (param != null)
{
command.Parameters.AddRange(param);
}
SqlDataAdapter db = new SqlDataAdapter(command);
DataTable dt = new DataTable();
db.Fill(dt);
return dt;
}
Upvotes: 0
Views: 953
Reputation: 14687
Looks like you have got the connection string from some else's machine. Here Data Source=(Localdb)\mssqllocaldb;
means it is pointing to "[Sql Server Express LocalDB 2014][1]"
.
Make sure you have it installed on you machine. You can also try connecting to DataSource=(Localdb)\v11.0;
which is "Sql server express 2012" and use it in your connection string. See if this works.
Upvotes: 0