I’ve added a LINQ-SQL link in my website to make objects and after that, I’m trying to write the neccesary code to search into a database.
In my case I am trying to display a column value assigned to another of other column into a DATABASE using the following code but I can’t:
Palabras_Definiciones quintanaserena = new Palabras_Definiciones(); // LINQ
if (searchInput.Attributes["value"] == quintanaserena.palabra)
{
Label1.Text = quintanaserena.definición;
}
Am I doing anything wrong?
In the code above, you are not doing any request to the database. You only created the object that has the same definition as your database table.
To query your database, you need to do a query over your DataContext (usually the name of your .dbml file).
MSDN has a good web page to show sample of query. You might want to take a look there: http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
Your query would probably look like: