Here is the table setup I have:
int | Design_1
0 | Design_A
1 | Design_B
2 | Design_C
var design = (from d in BikePartsDataContext1.handlebars
where d.@int == "0"
this.textBox1.Text = design.ToString();
SELECT [t0].[Design 1] FROM [dbo].[handlebars] AS [t0] WHERE [t0].[int] = @p0
I think you want the first record then based on Id?
// at top of file so you can use the extension methods using System.Linq; // code var design = (from d in BikePartsDataContext1.handlebars where d.@int == 0 // i removed the quotes add them back if this is truely a string/sql varchar select d.Design_1).Single(); // use single to ensure only 1 record will get selected this.textBox1.Text = design; // design will now be the value of Design_1
0, add them back if this is not the case
You can also rewrite it using only lambda expressions:
this.textBox1.Text = BikePartsDataContext1.handlebars .Where(x => x.@int == 0) .Select(x => x.Design_1) .Single();