The Select Statement picks fields from 2 databases : WHR WPAY
SqlConnection connect = new SqlConnection();
connect.ConnectionString = ConfigurationManager.ConnectionStrings["WEBPAY"].ConnectionString;
connect.Open();
SqlDataAdapter da = new SqlDataAdapter(@"Select WHR.dbo.PAYMAST.IDNO ,WHR.dbo.PAYMAST.EMPNO,FNAME,
WHR.dbo.PAYMAST.LNAME,WHR.dbo.PAYMAST.DEPTNAME from WHR.dbo.PAYMAST
where WHR.dbo.PAYMAST.IDNO not in
(Select WPAY.dbo.Paycurrt.idno from WPAY.dbo.Paycurrt)", connect);
DataSet ds = new DataSet();
da.Fill(ds, "Paycurrt");
GridView1.DataSource = da;
GridView1.DataBind();
connect.Close();
GridView1.SelectedIndexChanged += new EventHandler(GridView1_SelectedIndexChanged1);
ERROR MESSAGE
Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
In Configure DataSource I have the following.
The Test Query is ok.
SELECT IDNO, EMPNO, FNAME, LNAME, DEPTNAME FROM WHR.dbo.PAYMAST WHERE (IDNO NOT IN (SELECT IDNO FROM PAYCURRT))
Which I have tested and generates the Expected Output.
I want to populate the Gridview from the Page Load
What I have tried:
On going Development Challenge in C#