In Below image a View is showing in DataSources.
In Below image Same DataSource is shown in Data Set Design View
After drag and drop of Same DataSource on form as Grid DataMember property of same Grid is not showing the name in its list.
Propertis of Grid
Properties of Binding Source
ALTER View [dbo].[V_CustomerBalance] as
SELECT M.Sales_id,
M.Sales_date,
M.Customer_id,
M.Total_Weight,
M.Total_Amount,
M.Is_fully_paid,
SP.New_SrNo,
SP.Total_Amount_Paid,
(M.Total_Amount - SP.Total_Amount_Paid) AS Due_Amount
FROM SalesMasterTable AS M ,
(SELECT P.Sales_id,
MAX(P.Sr_no) + 1 AS New_SrNo,
SUM(P.Amount_paid) AS Total_Amount_Paid
FROM SalesPaymentTable AS P
GROUP BY P.Sales_id
HAVING MIN(P.Amount_due) > 0) AS SP
WHERE M.Sales_id = SP.Sales_id
GO
I think its Yes. If not then why?
Some times is simpler to go back to basics.
Firstly your data grid view should be using as its data source a binding source component.
The data member of the GridView should be empty with only the data source selected (to the binding source).
If you follow the steps below you will get a working copy of a grid view using a sql view.
This should create three components on you form.
Your grid view will have its data source attached to the Binding source. The binding source DataSource will be set to the DataSet Component in the form and its DataMember will display the view name. The Gridview should not display anything on the DataMember property as it will be getting all the data and information from the binding source.
In your code your binging source data member property should be set to the view name.
I hope this helps.