.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to type the following query in a query builder?

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :


How can I type the following query in a query builder when I am editing and configuring a data set from the edit designer using C# and SQL Server, so I can specify the Date format, to pick only the date from a column that has both date and time taken from a dateTimePicker?

SELECT        *
FROM            TABLE
WHERE        (ColumnName BETWEEN @dateFrom AND @DateTo)

Now I need to specify the format of the dates as only date without the time. In the query builder in the edit designer of a data set does not accept the code with the format:

SELECT        *
FROM            TABLE
WHERE        (ColumnName BETWEEN @dateFrom .('MM/dd/yyyy') AND @DateTo.('MM/dd/yyyy'))

How can I fix this and specify the format to take only the date when writing the query in a query builder when configuring a DataSet????

View Complete Post

More Related Resource Links

SSRS 2008 R2 - Query builder freezes and needs to be shut down Report Builder 3 when attempting quie

Hi, In SSRS, using Report Builder 3.0 (SSRS R2), after choosing a Report Model as the report's embedded data source, launched "Query Deisinger…" from GUI to build data source in report.  First 1-2 attempts at querying underlying data source (Oracle back-end), are successful, but later attempts freeze application to the point where application freezes and overall Report Builder application needs to be forcibly shut-down. This system freeze has occurred when referencing tables containing a very small number of records as well as larger data sets.  Suspect that application freezing may be caused by timing-out of connection to back-end database. but I am not sure. Any suggestion to solve this issue? Thanks   Environment - Distributed deployment Server1(report_srv) --Windows server 2003R2 64bit, Installed sql server 2008R2 reporting service, configuration tools Server2 (report_db_srv) --windows server 2003r2 64bit, sql server 2005 for report server database

Analysis Service Oracle Number inconsistent Data Type for TABLE or Named Query

Dear Gurus, I'd VERY OLD PROBLEM. And I believe it addressed since 2006. When I design DataSource Views from Oracle Data Source. I found it return different oracle number data type for TABLE or NAMED QUERY   Provider Data Type Column Data Type Data Source View Data Type Oracle OLE DB Provider (OraOLEDB.Oracle.1) Table Number System.Int64   View Number System.Decimal   Named Querey Number System.Decimal Microsoft OLE DB Provider for Oracle (MSDAORA.1) Table Number System.Double   View Number System.Double   Named Query   1 System.Int64   Named Query   1.1234 System.Int64 Althought I know I can fix IT via MANUALLY EDIT DATASOURCE VIEW XML SOURCE. But I don't think this is a better solution. Is anybody have ideas ?  Wilson

caml query builder for wss 3 site

hi, is there a caml query builder that can be use for WSS 3.0 sites?

Ms sql query for this type of table structure

Hi This is my Table structure Field1       Filed2        001          A001          B001          C 001          D002          A003          B 003          C I need MS SQL query I need to show Field1 which has B and Not in DI mean 003 will shown coz it has B still D not comes... and 001 ,002 will not shown Coz 001 has B and D and 002 will not shown coz still it doesnt have B..Need Query... 

Report Builder 3.0 for Oracle with Graphical Query Designer

Is there a possibility to have Graphical Query Designer in Report Builder 3.0 in case the connection is made to an Oracle database (through .NET Provider for Oracle for example)? I need to offer to the end users the means to build their own reports. Every user has associated a group of database objects and as soon as users are added new database objects are added. Therefore I cannot create a model because it needs to be changed frequently and the model in this case would contain objects to which the user does not have access. The only option is that the user should create his report query in a friendly manner. So the query text editor is of no good in this case.   I've found in documentation that for Oracle and other databases there is no Graphical Query Designer: In Report Builder 2.0, to specify a query for data source types Oracle, OLE DB, ODBC, and Teradata, you must use the text-based query designer (http://msdn.microsoft.com/en-us/library/dd220607(SQL.100).aspx). Is there a way to have Graphical Query Designer in Report Builder 3.0 or should I look for other products? In case Report Builder cannot solve this problem can you make some product recommendations - ad-hoc web reporting for .NET?

Where is 'Change query type' (Enterprise manager) equivalent in the Management Studio


In sql server 2000 Enterprise manager, there was a ‘Change Query type’ icon and on clicking it, it gave you the option of changing the current query to a

Insert into
Insert From
Create Table

I can’t seem to find this in SQL Server Management Studio, does it exist somewhere or is there an equivalent way of doing it. Any help would be appreciated.




Content Query Webpart Missing Content Type and Approval Status


I'm a great fan o the CQWP , and love the changes made in 2010 on this webpart. What bothers me is that I use to Filter Documents by Approval Status, thus showing Draft or Pending Documents and Group these by their Content Type.

Both these were available in 2007, but removed from 2010 CQWP. Any idea why, or how to bring this back? sample or URL guidance would be great. My gut feeling is custom XSLT but id like to confirm this first.

Thx a lot



SQL Server 2008 R2 Report builder - Cannot update a list of fields for the Query



I have existing report connected to SSAS cube. When I try to change the query and click OK, i get this message "Could not update a list of fields for the query. Verify that you can connect to the data source and  your query syntax is correct"

My Query syntax and access to data source dont have any problem.  Because fo this issue, i cannot update the query used in the report. How do i resolved this issue?



how to convert date type in SQL query output ?


In my database when anyone registers - By default the registration time is saved as UTC universal time zone.

But i want to display everything on the website in (GMT-05:00) Eastern Time (US & Canada)

I am using this SQL QUERY to display registration date:

SELECT TOP (5) Username, CustomerID,  RegistrationDate = CONVERT(VARCHAR(12),RegistrationDate,107)  FROM Customer ORDER BY RegistrationDate DESC

And, i am displaying it like this:

<asp:Label ID="nameLabeldate" runat="server" Text='<%# Eval("RegistrationDate") %>' />

The problem is the output is getting displayed as : 10/20/2010 1:36:01 PM

I know RegistrationDate is datetime stamp that's why i am getting output in this format.

But i want to display RegistrationDate as: Oct 20, 2010 at 1:36pm -> according to (GMT-05:00) Eastern Time (US & Canada) ORDER BY RegistrationDate in Desc (top most will be last registered user)

I need help with sql query by which i should be able to accoplish my desired output..please help...

Problems with AND/OR in SQL query in strongly type datasets



In my ASP.NET web application I am using strongly typed datasets for data access. In my dataset.xsd class I have added an SQL query that works in SQL Management Studio, and when executed in the Table Adapter Query Configuration Wizard --> Execute Query form. But when invoked from the application using the autogenerated table adapter it returns no hits.

INNER JOIN Department ON Department.Dep_Id = Device.Dev_Dep_id 
INNER JOIN Customer ON Customer.Cus_Id = Department.Dep_CustomerNr 
INNER JOIN RootCustomer ON RootCustomer.RCus_Id = Customer.RCus_Id
(RootCustomer.RCus_Id = @CustomerId) AND (Device.Dev_Status = 10) AND (Device.Dev_serial LIKE '%' + @searchPattern + '%') OR
(RootCustomer.RCus_Id = @CustomerId) AND (Device.Dev_Status = 10) AND (Device.Dev_CustMark LIKE '%' + @searchPattern + '%') OR
(RootCustomer.RCus_Id = @CustomerId) AND (Device.Dev_Status = 10) AND (Device.Dev_IpAddress LIKE '%' + @searchPattern + '%') OR
(RootCustomer.RCus_Id = @CustomerId) AND (Device.Dev_Status = 10) AND (Device.Dev_ArticleNr LIKE '%' + @searchPattern + '%') OR
(RootCustomer.RCus_Id = @CustomerId) AND (Device.Dev_Status = 10) AND (Device.Dev_Descr LIKE '%' + @searchPattern + '%')
ORDER BY Device.Dev_serial

What possib

Can you use IF Statements in the ASP.NET SQL Data Control Query Builder???


So in an access query I would put in the column name... FireCount: IIf([ClmTypeOfIn]="Fire",1,0) ... so if the incident was fire then it returns a 1 otherwise a 0

Tried to do the same thing in ASP.NET's built in query builder but it doesn't work :( suggests "IIf is not a recognised function name"...

any help is much appreciated :)

Query Builder - Show values where date is greater than DateTime now


Visual Web Developer 2010 Express

ASP.Net and C#


Hi Guys,

My issue is that I am pulled three tables together using the Query Builder and I only want to show data where a specific date is greater than todays date. Here is what i have so far:

SELECT        salesitems.sona, salesitems.sonitem, ZOverdueOrders.ZOOType, ZOverdueOrders.ZOOReason, salesitems.sduedate, salesitems.soitemstate
FROM            salesorders INNER JOIN
                         salesitems ON salesorders.son = salesitems.sona LEFT OUTER JOIN
                         ZOverdueOrders ON salesitems.sona = ZOverdueOrders.ZOOSON AND salesitems.sonitem = ZOverdueOrders.ZOOSONI
WHERE        (salesitems.sduedate > CONVERT(DATETIME, '2010-09-01 00:00:00', 102))
ORDER BY salesitems.sona, salesitems.sonitem

Where it says '2010-09-01 00:00:00' I want that to be the todays date.


Is this possible? Can anyone help please?

Thanks in advance for any help!!!!




Webmatrix.Data.Database.Query() method return type


I'm using the Webmatrix.Data.Database.Query method to return a result set in the following form

var myResult = db.Query("Select * from mytable");

How do you cast myResult to get the count of records returned? I'd like to do something like


Linked Server and the Query Builder

I have a Linked Server that I need to generate reports from two databases, is it possible to use the query builder with a linked server?  I have not found a way to do this, I would expect to select Linked Server as the data source.  Thanks.

SQL code works elsewhere, not in VS2010 Query Builder

SELECT caseid, recid, trandate, description, amount, SUM(amount) AS billtotal
FROM billtran GROUP BY caseid

The above SQL executes and gives me what I want under PHP/MySQL, but it won't even execute under VS2010 Express. When I put the above SQL code in the Dataset Designer Query Builder, I get an error: "In aggregate and grouping expressions, the SELECT clause can contain only aggregate and grouping expressions. [ Select clause = ,recid ]"

I don't understand what the problem is. What is the thing I must know about SQL that is different under Microsoft?

Update Query ? Incorrect use of the xml data type method 'modify'. A non-mutator method is expecte


I have a column of ntext da


ta type and NOT XML. It stores all xml data. I need to update xml node in the records. It throws an error saying "Incorrect use of the xml data type method 'modify'. A non-mutator method is expected in this context."

 begin transaction
declare @Cps_Id int;
set @Cps_Id = 236;
declare @Cps_Message nvarchar(1024);
set @Cps_Message = 'updating cpsia message with smoking';

update table_name
set column_name = CONVERT(xml,column_name).modify('replace value of (/root/ProductInformation/CPSIA/CpsiaDetails/Item[CpsiaId=sql:variable("@Cps_Id")]/CpsiaMessage/text())[1] with sql:variable("@Cps_Message")')
WHERE Convert(xml,column_name).exist('/root/ProductInformation/CPSIA/CpsiaDetails/Item[CpsiaId=sql:variable("@Cps_Id")]')=1


Sample XML:

<strong><root> <ProductInformation> <Name> Truck with Battery Charger</Name> <Description>Fr.</Description> <CPSIA> <CpsiaDetails> <Item> <CpsiaId>456</CpsiaId> <CpsiaMessage>waring</CpsiaMessage> </Item> <Item> <CpsiaId>236</CpsiaId> <CpsiaMessage>to health</CpsiaMessage> </Item&

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend