while table1 is not empty
LINQ statement to grabe data from table1
concate the data from LINQ statement above with user typed in textbox value
if(LINQ statement to compare the concatenated word match values in the table2)
{select all the data;}
Then at the end, databind the result with a DataList control. Can this be done? Any suggestion is much appreciated.
Many thanks for the help, I ended up in using store procedure.
CREATE PROCEDURE [dbo].[editSearch]
-- Add the parameters for the stored procedure here
@txtSearch varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
--combined the consonants from the table with the entered texts and insert into a temporary table wrdCombined
SELECT wrdID, consonant + @txtSearch as Word INTO #wrdCombined
FROM [dbo].[consonants]
--grab the matched word from the table
SELECT * FROM #wrdCombined, [dbo].[myWord]
WHERE #wrdCombined.Word = [dbo].[myWord].word
DROP TABLE #wrdCombined
END
Marked as answer by mychucky on Jul 24, 2012 02:16 PM
mychucky
Contributor
4358 Points
3709 Posts
Can I use While-loop or Foreach loop?
Jul 17, 2012 05:48 PM|LINK
Here's what I wan to do.
while table1 is not empty
LINQ statement to grabe data from table1
concate the data from LINQ statement above with user typed in textbox value
if(LINQ statement to compare the concatenated word match values in the table2)
{select all the data;}
Then at the end, databind the result with a DataList control. Can this be done? Any suggestion is much appreciated.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Can I use While-loop or Foreach loop?
Jul 19, 2012 01:28 AM|LINK
What kind of Table? DataTable?
What do you mean by "fetching"?Any other "where" conditions?What result do you expect?
What do you mean by "Compare"?
martinyap
Member
38 Points
14 Posts
Re: Can I use While-loop or Foreach loop?
Jul 24, 2012 04:43 AM|LINK
Hi,
Foreach is much faster than While because the more condition checking the more your apps gets slow.
Foreach will automatically stops until it HIT the end of the collection data.
please mark this answered if it helps.
mychucky
Contributor
4358 Points
3709 Posts
Re: Can I use While-loop or Foreach loop?
Jul 24, 2012 02:15 PM|LINK
Many thanks for the help, I ended up in using store procedure.