DataSource Controls :: Select Query For Retrieving Data Between 2 Dates?

Jan 8, 2010

I want to create an application where I need to enter date to the ms access database.

I am a bit confused regarding how to make the user to enter date. The options avaliable are:

a. Shall I use a textBox?

b. Shall I go for 3 drop down lists?

or something else.

Some more questions:

1. what date format shall i use? (dd-mm-yyyy, dd-mmm-yyyy, etc, etc or anything else)

2. What datatype shall i use to store the date in the database?

3. What SQL query shall i use to retrieve the data between 2 dates?

let me know if there are multiple options available regarding this application.

I want to make this application as easy as possible for the user.

View 4 Replies


Similar Messages:

DataSource Controls :: SQL Query Involving Dates?

Apr 24, 2010

how to right an SQL Query which will retreive Records of Tasks whose Deadline lies between two given dates.. The deadline is of type datetime.

View 5 Replies

DataSource Controls :: Select All Dates From DB Where Date Is Within A Period (from - To)

Jan 18, 2011

a user will choose a period of time (from this date to this date) with a calendar ,, and then i want to get from DB all Invoices that were created within this period ??

each Invoice has a Date saved in Database..

This is the sql select statement i am using:

SelectCommand="SELECT [invoiceid] FROM [invoices] WHERE (([location] = @location) AND ([name] = @name)) AND date BETWEEN '"+ (fromdate.SelectedDate.ToShortDateString()) +"' AND '" + (todate.SelectedDate.ToShortDateString()) + "'">

i am getting this error message:

System.Data.SqlClient.SqlException: Conversion failed when converting date and/or time from character string.

View 8 Replies

DataSource Controls :: How To Check Two Date Columns In Sql If Dates Are Same Then Select One

Apr 6, 2010

i have DateFrom and DateTo columns in tblLOgs.if they both are same then select only DateFrom else both selects.my procedure is ....do modification in them

[Code]....

View 6 Replies

DataSource Controls :: Select Query / Not Filtering Data From Database?

Mar 19, 2010

i have used one query like this

Select skillReq from tblPostJobs where SkillReq like '%Silverlight 2.0%'

it is working fine. But while giving

Select skillReq from tblPostJobs where SkillReq like '%Silverlight 2.0,C#%'

It is not filtering data from database. It is only checking starting and ending Character.In my database some keyskill are like that

Asp.net 3.5,4.0,C#,Sql server 2008,Silverlight 2.0,3.0.

My requirement is to check each word in "SkillReq" text.

View 3 Replies

ADO.NET :: Retrieving Multiple Values From A Select Query?

Oct 12, 2010

This code works just fine for me to select * from x,y,z. However what I want to do is retrieve the values return and assign them to variables. How do I go about this?

[Code]....

View 1 Replies

DataSource Controls :: Select Query Doesn't Work When Data Is Present In Arabic MS Sql 2005

Jan 26, 2010

This query does not return any record

[code]....

View 3 Replies

DataSource Controls :: SQL Query With IF And Select

Feb 18, 2010

SQL Query with IF and Select

View 2 Replies

DataSource Controls :: Sql Select Query Where Date

Apr 13, 2010

in DataBase Attendancedate is save in this format 4/5/2010 4:16:28 PM ..i want to query like this select * from EmployeeAttendance where Attendancedate='4/5/2010' but this giv error

View 5 Replies

DataSource Controls :: Multiple Like Statements In One Select Query

Mar 15, 2010

I need to write a select query where it will be doing "like" on one column with multiple strings.

Eg : Select * from tblCity where city like '%ABC%' and city like '%XYZ%'

I have set of strings.

View 5 Replies

DataSource Controls :: SQL Select Statement - Values To Appear In Same Query

Feb 15, 2010

I am having difficulty selecting data from 2 tables that do no share a primary key value. For instance, I have an actual table, a forecast table, and a GLText table. I may have an actual value but not a forecast value but I need them to appear in the same Query (like the query results shown below). I can get all values to appear in each table but have been unsuccessful in getting all values from both tables.

View 5 Replies

DataSource Controls :: Include An Alias In Select Query?

Jun 22, 2010

I have an application that I am developing using ASP.Net with visual basic code. I have a table called "Customers" that contains 3 fields. The name of each field is "Name", "LocationA", and "LocationB". I want to code a select query that list two columns. The first column should contain the field "Name". I want the second column to contain the value in the field "LocationB" if "LocationB" is not null, else I want the second column to contain the value in the field "LocationA".

View 4 Replies

DataSource Controls :: Filtering Between 2 Values In A Query From Dropdownlist Select?

Feb 17, 2010

I have dropdownlist of dates and depending on the date that the user selects from list, I would like to filter records that fall between the startyear and finishyear columns in the datasource. (My the problem is that I do not know how to declare the Startyear and Endyear from the query in the code as they appear underlined - probably the BETWEEN syntax is wrong too).

yYear = DropDownList1.Text
Using connection As New SqlConnection("Data Source=CHRIS-PCSQLEXPRESS;Initial Catalog=TorGHL;Integrated Security=True")
Dim cmd As String
cmd = "SELECT BarDetails.*, MenuHeadingId AS Expr1 FROM BarDetails WHERE (MenuHeadingId = 2)" & "WHERE " & yYear & " BETWEEN " & "(" &
StartYear & ")" & " AND " & "(" & EndYear & ")"
connection.Open()
Dim dapubcb As New SqlDataAdapterDim sqlcomm
As
New SqlCommand(cmd, connection)
dapubcb.SelectCommand = sqlcomm
Dim dspubcb As New DataSet("BarDetails")
dapubcb.Fill(dspubcb, "BarDetails")

View 4 Replies

DataSource Controls :: Write Select Query To Get Counts In Row Values?

Jun 2, 2010

How to write select query to get counts in row values

View 6 Replies

Forms Data Controls :: Using The Code To Select Data Which Appears Between 2 Dates?

Jan 16, 2010

I am using the following code to select data which appears between 2 dates:

string query = "SELECT (name, date) FROM date where tableinfo
BETWEEN @date1 AND date2";[code]....

Now the above code is working fine. The only problem is that the date in the date column of the gridview is not in the proper format. What can i do in order to change the format of the date in the gridview. If the format of the date is changed in the databse itself I may be able to use the above SQL query.

View 8 Replies

DataSource Controls :: Select Query Not Working / Getting An Invalid Column Name Error?

Jul 9, 2010

i have the following select staement which deosnt work, can anyone advise me whats wrong with it:

string _name = ddl_Name.SelectedValue.ToString();
string cmd =
"SELECT ID, Telephone FROM User_List WHERE Name = '' + _name;

i keep getting an invalid column name error? and i know the syntax next to _name isnt correct. how are the single quotes meant to go?

View 3 Replies

Web Forms :: Selected Dates From DB Become Deselected When Try To Select New Dates?

Jan 13, 2011

once a user select an item from dropdownlist > Dates from DB are shown on calendar in pink color.

The problem now is when i want to select new dates the selected dates(in pink) become deselected .. I want them to stay selected so i can know which dates are already used .

[Code]....

View 5 Replies

DataSource Controls :: Using Values Selected From A "check Box List' In A SQL Select Query?

Jul 5, 2010

I have a table called 'Customer' that contains customer information. One of the fields is named "CustomerType". Each record in the 'Customer' table will contain the value of either "C", "I", or "O".

I have a form that contains a "check box list" named "Type". There are 3 values in the "check box list". The values are "C", "I", and "O". The user can select one or more of these values. I have a button on the form named "btnRunQuery.

When the user clicks on the button "btnRunQuery" I want to exectute a query that selects the records contained in the "Customer" table where the value in the field "CustomerType" equal the values the user selected in the "check box list". Example: If the user selected "C" and "O", then I want the select query to select all records that contain either "C" or "O" in the field "CustomerType".

I assume that what I need to do is to capture the values that the user selected in the "check box list" and put them in a variable. Then I need to format the "Where" statement in the query and add a "Parameters.AddWithValue" command.

View 2 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

Forms Data Controls :: Retrieving The Values Of A Cell In GridView Upon Select?

Jul 2, 2010

My gridview has a dropdownlist when the user clicks "Edit". my question is: How to I retrieve the value of the cell that contains a dropdownlist (when the user clicks on "Select")?

I am able to retrieve the information from the cell that has a textbox (textbox is displayed ONLY when the user clicks on Edit). But when I try to retrieve information from any cells that has a dropdownlist (dropdownlist is displayed ONLY when the user clicks on Edit), it comes up blank.

In order to retrieve the cell I have used the following below:

[code]....

View 12 Replies

DataSource Controls :: Implementing A BLL / Contacts Table, The Select Method Is A Sql Query Against A Sql Server 2000 Database?

Feb 17, 2010

I'm implementing a BLL layer and have a few questions. First, in my DAL, there is a contacts table, the select method is a sql query against a sql server 2000 database. The preview data returns everyting as expected. The query is

[Code]....

The BLL method is built like so

[Code]....

When using the BLL method to a gridview, the results of the subquery are not displayed. There are also other methods, each having a different where clause for ContactRole_ID and each is having the same issue of not displaying the subquery reult in the gridview. No error, but no data is displayed for the subquery either. Here is the templatefield of the gridview

[Code]....

Another item that is causing an error is in trying to update a record. Here is the DAL update method

[Code]....

And the BLL update method

[Code]....

The error says i have extra parameters, but have no clue where the extra parameters are being picked up. The error isObjectDataSource 'odsContacts' could not find a non-generic method 'UpdateContact' that has parameters: _ContactID, _Active, _ContactName, _Office, _VirtualOffice, _Pager, _Fax, _Home, _Cellular, _Email, _ContactRole_ID, Active, ContactRole_ID, ContactName, Office, Email, VirtualOffice, Pager, FAX, Home, Cellular.And the objectdatasource

[Code]....

View 4 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

DataSource Controls :: Retrieving Data From SQL Server?

Mar 17, 2010

I try to use one Calendar, i have example with XML, but i wont to read from SQL,

[Code]....

View 2 Replies

DataSource Controls :: Retrieving Sql Data Into An Array?

Feb 24, 2010

I'm new to asp.net, php had this function that could store sql date in an array, I can't find something similar in .net, so this is what I came up with so far.

Sub Compareid()
Dim queryString As String = "Select top 2 id from my_videos order by id desc"
using connection As New SqlConnection(ConfigurationSettings.AppSettings("sqlacct")

[code]...

View 6 Replies

DataSource Controls :: Retrieving Data From Multiple Tables?

Aug 17, 2010

I have hard time trying to find the solution to retrieve data from multiple tables in one database.

table Kategorije has fields: idKategorija, naziv, opis table Clanak has fields: idClanak, idKategorija, naslov, autor,...

Kategorije.idKategorijais joined with Clanak.idKategorija, but that isn't the solution because I want my web site to show the Kategorije.naziv instead of Kategorije.idKategorija. This is the code I'm currently using to get idKategorije shown on my web site:

[Code]....

[Code]....

View 3 Replies







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