Showing posts with label fill. Show all posts
Showing posts with label fill. Show all posts

Saturday, February 25, 2012

DataAdapter does NOT load relations from DB

Why DataAdapter does NOT load relations from DB ?

the relations are made using SQL SERVER MANAGEMENT

but when a fill a datatable using dataadapter the relations are not loaded .

why ? what is the solution to this problem ?

Because it doesn't, nor would it be appropriate for it to. Your code may want to set up different relationships than those enforced by the database. Or setup up no relationships. If you want the relationships in your code, then you'll need to add them yourself.

DataAdapter - SELECT Statement - items in last 30 days

I'm using DataList to return vales stored in an SQL database, of which one of the fields contains the date the record was added.

I am trying to fill the dataset with items only from the last 30 days.
I've tried a few different ways, but all the database rows are returned.

What is the WHERE clause I sholud use to do this??

ThanksTry with the following SQL statement, i belive it should work.

select * from <tablename> where datediff(day, <columnname>, getdate()) < 30

Hope it solves your issue.|||Thanks very much, it worked a treat