Forms Over Data
Hi...friends.!
I have a form with a gridview and dataset called CommingBdaysDataSet.xsd .what I want to do is; I want to configure the tableAdapter of above xsd file to get the following output to the gridview when the form loading..
I'm developing a birthday reminder and I want to get the comming/future birthdays(ex:today is 21st Nov and bdays until the end of yr 2008).
I wrote a query to the above tableAdapter using query builder.here it is;
SELECT Lname, Fname, Address, BirthDay, EmpID
FROM Employee
WHERE (BirthDay BETWEEN GETDATE() AND 365-GETDATE() )
I think this should b corrected.And is it enough to attach this xsd to gridview using its datasource link?Or do I need to do some additinal coding.
And I have only one table called Employee in my DB.I want to get some fields from table.(EID,Fname,Lname,Bday,Address)I have already designed dataset using this table.
I have stuck with this issue.
If anyone can please help me to obtain a solution for this.
Thank you
Charith
Charith LiyanagamagePosted Dec 13, 2008, 2:22 AM
Mamta MPosted Nov 24, 2008, 5:00 AM
Hi there,
Your approach and action to do the data binding are correct but the query itself is wrong. I tried your query here and it didnt work at all. What you need is a query similar to the below: (I m pasting only the WHERE portion, you add the rest from your original code)
WHERE
(BDay BETWEEN GETDATE() AND (SELECT '12/31/'+ CONVERT(NVARCHAR(4),DATEPART(YEAR, GETDATE()))))This should give you the results.
-Mamta