DataSource Controls :: Query Returns 0 Records?

Jun 5, 2010

How come my query returns 0 records?

SELECT WebSiteID, BanDate
FROM tblWebSite
WHERE (BanDate <> NULL)

The BanDate is a date column. There are date times through the table in this column. I just want the ones with a date and ignore the rest.

View 2 Replies


Similar Messages:

C# - SubSonic .Paged() Query Returns Duplicate Records

Feb 8, 2011

Using a SubSonic (2.2) SqlQuery object, I am querying a view that contains distinct rows from another table. The results of the query, however, contain multiple rows for certain rows in the view. It appears to be because of a join on a temporary table in the query generated to achieve paging. How can I avoid this duplication of rows?

Bonus points: I have to use the view because SubSonic can't do .Paged() and .Distinct() at the same time. Why not?

View 1 Replies

SQL Server :: Select Query That Returns Records By Date Today

Sep 22, 2010

In my data table i have a Date Column with of type DateTime.

In my sql select query, I want to return all records where the date is today.

View 8 Replies

DataSource Controls :: Xml.query In Sql And No Records?

Mar 15, 2010

I have table in database with xml field and data like below

[Code]....

there are no records found

View 1 Replies

DataSource Controls :: Trying To Query Records From A Db Using A Date

Apr 14, 2010

I'm trying to query records from a db using a date. But somehow the db doesn't return records.

The datetime collums have the data stored in this format in the db as datetime :

12-Apr-10 12:45:12 AM
The string a have available is in this format : 12-Apr-10

I need to somehow strip the time part of so i can use my date string in the query.

When i use the below method the database converts the datetime to a rounded date (12-Apr-10 12:00:00 AM).
But when i query for that date i still get no results.

I tried this:

SELECT ID, PerformedBy, SystemId, ServerId, CAST(FLOOR(CAST(CreateDateTime AS FLOAT)) AS DATETIME) AS Expr1, Reason, Action, Summary, EnteredBy,
Collumn1, Collumn2
FROM Changes
WHERE ('Expr1 = '12-Apr-10 12:00:00 AM')

But this way the Expr1 collumn is not recognized.

View 4 Replies

DataSource Controls :: Query With DataSet To Get Every Time Next 20 Records

Apr 29, 2010

I am using dataset which contains some records I want to query with dataset to get every time next 20 records. I don't want to do it throught loop is there any way that I can get next 20 records everytime.

View 5 Replies

DataSource Controls :: To Write The Query - Retrieve The Records?

Jan 16, 2010

i have a table for customer forecast with following fields.. customer, year, week, quantity. now i need to write the SP to retrive the records based on the from week,year and to week,year... like this... from 45th week of 2009 to 25th week of 2010. how can write the query...

View 4 Replies

DataSource Controls :: Sql Query To Show All Combination Of Records?

Jan 18, 2010

I've the following tables and I want the query to show all possible combination of records with SegmentID, RateCodeID & MealPlanID.

View 2 Replies

DataSource Controls :: Update Query To Edit Records And Save To Database?

Feb 22, 2010

I am doing update query to edit my records and save to my database...I am getting the query expression exception...syntax error (missing operator) in query expression 'WebLogin=krish'.

string strUserName = Request.QueryString["UserName"].ToString();
DateTime dateTimeNow = DateTime.Now;
string ConnString = ConfigurationManager.ConnectionStrings["Data"].ConnectionString;[code]....
I am getting the exception syntax error (missing operator) in query expression 'WebLogin=krish'.

View 3 Replies

DataSource Controls :: Linq Query To Select Parent Records Which Have Related Children

Jan 19, 2010

I have a basic CMS which I'm adding to a site to display some downloads organised into groups. I have two tables, one for the groups and one for the downloads. I'm using a repeated to display the groups with another repeater inside to display the children. This works perfectly.

However some of my download groups may not have any downloads related to them and I'd like to handle this by filter the groups so that only those with a relate download record(s) are shown.

I'm trying to do this with the query which populates the top repeater based on some ideas I read but I must be going wrong with the syntax.

Here is what I'm using to try and only select downloads groups which have downloads linked to them by the download group ID.

[Code]....

Can anyone offer any thoughts on how I should construct the query to perform this?

View 1 Replies

DataSource Controls :: Clause Criteria Eliminating Records In Outer Join Query?

Feb 15, 2010

I know I'm missing something here but I can't figure out what it is. I've got a query joining three tables....accounts, payments, and a table linking the two (there is a M:M relationship).I'm trying to pull a list of all accounts in the account table that have a payment that needs to be resequenced, and also the maximum payment priority if there are any payments that haven't been fully paid. If all payments HAVE been fully paid, I want to return a 0.

It's that last bit of logic that I can't get right. If I include that in the where clause, I get only the accounts that have a payment that hasn't been fully paid. If I take it out, I get all the accounts I get, but I get the highest payment priority whether or not the payment has been fully met.

Here is the query....how do I include the where clause criteria but still include all accounts?

select distinct
bat.acct_id,
isnull(max(isnull(crt.pymt_priority, 0)), 0)[code].....

View 6 Replies

Forms Data Controls :: How To Display Records After Going Through The Query Builder And Select "Test Query"

Nov 5, 2010

I have a SQL Data Source that displays records after going through the Query Builder and select "Test Query" yet when I save it, go back to the design mode and select View in Browser I get nothing but a blank screen.

View 3 Replies

SQL Server :: Select Second Query If First Query Returns Nothing?

Oct 14, 2010

How can I SELECT second if first SELECT returns nothing?

View 8 Replies

Forms Data Controls :: Database Query Returns 2 Rows But Repeater Only Shows 1?

Apr 12, 2010

here is my code:

My sql query is returning 2 rows by my repeater is only displaying 1.

[Code]....

View 3 Replies

SQL Server :: SqlDataAdapter Update Returns 0 Records?

Jan 25, 2011

using ASP.NET 2.0 SqlDataAdapter update returns 0 records. I have a simple application that stores Passenger's ticket info in a sql database.

when a user clicks "Create Reservation" I add a Passenger Information (name, destination, PNR) to dataset
and save dataset in ViewState.

Then when user clicks update, I pull the dataset from viewState and try to update database. The update is returning 0. what i am doing incorrectly?

protected void btn_CreateReservation_Click(object sender, EventArgs e)
{
DataRow dr ;
dr = dt.NewRow();
dr["Name"] = txtBox_Name.Text; dr["Destination"] = txtBox_Destination.Text;
dr["PNR"] = Convert.ToInt32(txtbox_PNR.Text); dt.Rows.Add(dr);
dt.AcceptChanges();
ViewState["MyTable"] = dsPassengers;

[Code]....

View 1 Replies

DataSource Controls :: SqlDataSource And Parameters Query / Trying To Accomplish Is Building Dynamic Query

Aug 22, 2010

1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like

SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.

Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).

2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query

(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).

If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.

View 11 Replies

SQL Server :: Update Multiple Records - Subquery Returns More Than 1 Row

Jan 5, 2011

I have a table line (ID, LineNo, LineName) having values as :

1, 1, <blank>
2, 2, <blank>
3, 3, <blank>

ID is PK with Auto-Increment and LinNo(I am manually incrementing through ASP.Net Page while record insertion) Now i have to write a query such that it updates LineName column from line table which is blank(as shown above) with values from table linet(linenamet) having values as :

a
b
c

My trial query is :
update line set LineName = (select linenamet from linet);

It gives ERROR as : Subquery returns more than 1 row
Expected Result : After Updation it should show line table as :
1, 1, a
2, 2, b
3, 3, c

View 8 Replies

Web Forms :: Class Method Returns Incorrect Records

Apr 27, 2016

This is the query I am running in DB:

select UM.USER_NAME, RM.ROLE_ID, RM.ROLE_NAME
FROM [MICommonDB].[dbo].[ROLE_USER_MAPPING] as RUM
join [MICommonDB].[dbo].[ROLE_MASTER] as RM ON RM.ROLE_ID=RUM.ROLE_ID
join [MICommonDB].[dbo].[USER_MASTER] UM ON UM.USER_ID = RUM.USER_ID
where UM.USER_NAME='useruser'
which is giving me proper result(i.e., 2 records) when running in SQL server.

Now I have created below method in a class with same query (I am calling this method inside Controller):

public IEnumerable<RoleUserDO> getRoleNameByUserName(string userName)
{
IEnumerable<RoleUserDO> strResult = null;

strResult = (from RUM in oDBContext.ROLE_USER_MAPPING

[CODE]..

but it returns only 1 record instead of 2 records(when compared with DB query)

View 1 Replies

DataSource Controls :: Update Query Not Working When Using Query Builder To Configure Table Adapter

Jan 15, 2010

[code]...

This query works perfectly on the query analyser.

But when configuring the Table adapter ,I try executing the query and i get 0 rows affected.

What could I be getting wrong in this case.

NB:Existing GalleryID has been supplied.

View 1 Replies

DataSource Controls :: Can't Find Query's / By Right Clicking On Database Created A Query In Server Explorer?

May 17, 2010

By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.

View 10 Replies

SQL Server :: Update Statement Not Updating Records And Returns No Errors?

Sep 16, 2010

I am running an Update statement against an SQL database on server 2008. The update runs but does not update the record, but returns no errors.The database is part of a commercial help desk package called TrackIt 8.5 which was just a fresh install on a new web server and a new sql server. The update is running from a web form we use to automatically create active directory accounts. After the account is created the web form closes out the work order in the Trackit db. This was working fine when the system was running on Server 2003 and SQL server 2005. Running Trackit version 7.02.The login use to access the database has full permissions to read and write to the database, just as it did on the old server which never had an issue updating. Odd thing is, if I log onto the SQL server and make a change to any single field in that record. I can then run the web form and it updates the record normally.

View 3 Replies

Linq Query Returning Less Records Than Sql Query?

Mar 19, 2011

I am facing a big problem with simple linq query.. I am using EF 4.0..

I am trying to take all the records from a table using a linq query:

var result = context.tablename.select(x=>x);

This results in less rows than the normal sql query which is select * from tablename;

This table has more than 5 tables as child objects (foreign key relations: one to one and one to many etc)..

This result variable after executing that linq statement returns records with all child object values without doing a include statement.. I don't know is it a default behavior of EF 4.0 . I tried this statement in linqpad also..but there is no use... But interesting thing is if I do a join on the same table with another one table is working same is sql inner join and count is same..but I don't know why is it acting differently with that table only.. Is it doing inner joins with all child tables before returning the all records of that parent table?

View 2 Replies

DataSource Controls :: SQL Only Returns All The Rows Some Of The Time

Jan 15, 2010

Iam confronted with a really weird issue the like of which ive never seen before. I recently developed a web application using ASP.net and launched it for my company, during the bug testing stages everything seemed fine, but once it was actually in production i started getting these weird errors that all stem from it not retrieving the correct rows.

The issue is this, sometimes the queries sent to the back end only return a partial amount of the rows actualyl requested, so if a user has a page loaded thats suppose to return X number of rows, they can sometimes get X - Y number of rows, and upon refreshing the page they get X - Z number of rows, and refreshing the same exact page again they might get X number of rows they were initially suppose to see. I've never seen anything like this before so Iam stumped.

I consulted some of the old developers in the company I used to work for, for assistance but when explaining and showing the problem they too were very confused with the issue.

View 10 Replies

DataSource Controls :: Output Parameter Always Returns 0?

Apr 15, 2010

I have a gridview that has the header row modified in order to add new records; the gridview is bound to a sqldatasource control. In my code behind, i handle the insert in the following manner:

[Code]....

I know the insert is occuring because the new record shows up in the grid after the databind, but the output parameter is not picking up the scope_identity() value...what am i doing wrong with the output parameter?

View 2 Replies

DataSource Controls :: How To Convert Sql Query Into Linq Query

Mar 10, 2010

select Groupid,GroupName,onorusername from palgroup where groupid in (select distinct Groupid

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved