TableName:Upload
| ID | Keyword |
| 1116 | Dot Net |
| 2836 | Dot Net |
| 5636 | Dot Net |
TableName:Index_list (Resultant Table)
| ID | Keyword |
| 1116,2836,5636 | Dot Net |
Sir i need the sqlcommand query to get resultant table in asp .net(c# language)
I tried the following command,but it gives the result same as Upload table.
SqlCommand cmnd= new SqlCommand("select Upload.Keyword,ID=replace((select ID as [data()] from Index_list where Index_list.Keyword=Upload.Keyword order by ID for XML PATH('')),'',',') from Upload group by Keyword", con);
it works in SQL Server Management Studio,but not in Visual Studio 2012 sqlcommand .Please help.....
14 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Shubham KumarPosted Feb 16, 2016, 3:41 AM
SqlCommand cmnd = new SqlCommand(query, con);
Shubham KumarPosted Feb 16, 2016, 4:31 AM
Saafia NMPosted Feb 16, 2016, 4:30 AM
Saafia NMPosted Feb 16, 2016, 4:29 AM
Amit Kumar SinghPosted Feb 16, 2016, 4:28 AM
Shubham KumarPosted Feb 16, 2016, 4:20 AM
-------------------------- ----------
10, 100, 1000, 1000 a
Saafia NMPosted Feb 16, 2016, 4:15 AM
Saafia NMPosted Feb 16, 2016, 3:17 AM
Saafia NMPosted Feb 16, 2016, 3:06 AM
Shubham KumarPosted Feb 16, 2016, 2:57 AM
Saafia NMPosted Feb 16, 2016, 2:53 AM
Shubham KumarPosted Feb 16, 2016, 2:41 AM
Saafia NMPosted Feb 16, 2016, 2:38 AM
Shubham KumarPosted Feb 16, 2016, 2:35 AM