I am trying to retrieve data from 2 tables in my database and show it on the formview.
After I drag in SQLdatasource control into the webform, and hit the radio button on specify a custom SQL statement or stored procedure, and later hit on the "Query builder" under the SELECT tab.
Following which, i added the tables in; aspnet_Membership and Details tables. After checking on the checkboxes of the column which I which to select and hit the "Execute Query" button.
here the problem, after running, the title of the column came out
but the rows of data inside the tables didn't appear.
if I join aspnet_Membership with another table, or Details table with another table, it work perfectly fine. Only when I join aspnet_Membership and Details table the data does not appear
what can i do? anyone help me please, i had been researching about this the whole day but was not fruitful.
The most likely explanation is that the tables don't contain related data. On which columns are you joining? Are you sure that the Details table contains records that have a column that matches the column you're joining on from the Membership table?
Just like @Imar said, if two tables didn't have match column, it will not show any data in output. Please make sure that the condition you use is the matched column in two tables. You could select each table to check it. If they didn't have matched column,
it seems you need to use another condition in your query. If you use JOIN in your query, you could reference on below link to choose one.
mathidioticz
Member
1 Points
25 Posts
Using ASP.Net SQLdatasource using define custom statement
Jun 30, 2012 04:28 PM|LINK
Hi experts,
I am trying to retrieve data from 2 tables in my database and show it on the formview.
After I drag in SQLdatasource control into the webform, and hit the radio button on specify a custom SQL statement or stored procedure, and later hit on the "Query builder" under the SELECT tab.
Following which, i added the tables in; aspnet_Membership and Details tables. After checking on the checkboxes of the column which I which to select and hit the "Execute Query" button.
here the problem, after running, the title of the column came out but the rows of data inside the tables didn't appear.
if I join aspnet_Membership with another table, or Details table with another table, it work perfectly fine. Only when I join aspnet_Membership and Details table the data does not appear
what can i do? anyone help me please, i had been researching about this the whole day but was not fruitful.
Imar_Spaanja...
Contributor
2784 Points
481 Posts
ASPInsiders
MVP
Re: Using ASP.Net SQLdatasource using define custom statement
Jul 03, 2012 08:04 PM|LINK
Hi there,
The most likely explanation is that the tables don't contain related data. On which columns are you joining? Are you sure that the Details table contains records that have a column that matches the column you're joining on from the Membership table?
Imar
My Blog - My Company
Chen Yu - MS...
All-Star
21569 Points
2493 Posts
Microsoft
Re: Using ASP.Net SQLdatasource using define custom statement
Jul 05, 2012 05:52 AM|LINK
Hi mathidioticz,
Just like @Imar said, if two tables didn't have match column, it will not show any data in output. Please make sure that the condition you use is the matched column in two tables. You could select each table to check it. If they didn't have matched column, it seems you need to use another condition in your query. If you use JOIN in your query, you could reference on below link to choose one.
http://www.mssqltips.com/sqlservertip/1667/sql-server-join-example/
Thanks.
Feedback to us
Develop and promote your apps in Windows Store