473,468 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to insert a record and to retrive records between two dates for MS Access

64 New Member
Hi,

i am doing program in asp.net using vb coding and MS Access as back end.

i am having a table with date field and manipulation is based on the same.

i am inserting value from textbox using sql query as follows

ex: Textbox1.text="10-04-2007" (ie. in dd-MM-yyyy format)

dim dat as date = Textbox1.text
Insert into tablename (datefield,others) values ('" & dat & "','" & textbox2.text & "')",con)

datefield in my database is date/time ( short date)

while retriving records between two dates as per below query, i am not getting the result

select * from tablename where datefield<=#'' & textbox3.text & "'# and datefield=#'' & textbox4.text & "'#

any idea
May 3 '07 #1
4 2002
kenobewan
4,871 Recognized Expert Specialist
I believe that your query is still reading your dates as text. HTH.
May 3 '07 #2
PerumalSamy
64 New Member
Sorry, I cant get you
May 3 '07 #3
PerumalSamy
64 New Member
Even the following query is also not working.

dim fromdate as date=format(cdate(textbox3.text),"MM-dd-yyyy")
dim todate as date=format(cdate(textbox4.text ),"MM-dd-yyyy")

select * from tablename where cdate(datefield)<=#'' & fromdate & "'# and datefield>=#'' & todate & "'#

The above coding is working in my system. But while uploading in server, i am getting error as "cast from string "30/4/2007" to type "date" is not valid
May 3 '07 #4
myrrdin
6 New Member
Try using the Access Date method in your query

select * from tablename where datefield<=Date('' & textbox3.text & "')"
May 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paul# | last post by:
how do i query for a record between two dates using Access 2000? right now Im doing this: SELECT * FROM tblDateTotal WHERE .<>0 And . Between 1/1/1901 And 10/10/2050;
5
by: nicholas | last post by:
I would like to insert a new record in a Ms Access database and retrieve the newly created ID (autonumber). I would like to do it in VB.NET for an ASP.NET page. ( no asp) I found several...
1
by: nicholas | last post by:
To insert a record in a Ms Access database and be able to retrieve the newly created ID (autonumber) I used the code below (code 1). Now, the problem is that this is not very secure and that, if...
1
by: jaYPee | last post by:
i'm wondering how can i insert record into my sql server 2000. i have already created a connection to my sql server 2000 using the wizard. i added 4 sqldataadapter and 1 dataset. because i am an...
3
by: ebru | last post by:
about insert/delete/update records in mysql server with asp code how can I insert record in mysql database.. I insert into database but if I leave one text box empty, its give me error how can...
0
ak1dnar
by: ak1dnar | last post by:
There is a Error getting while i am entering records using this jsp file. <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> <%@ include...
0
by: catwalk | last post by:
Please can anybody help me??? I've never worked with db2 before. I'm working on MFC application and I need a little help and advice how to insert and retrive data into db2. For an example, how can...
1
by: jignesh thanki | last post by:
how insert record through query in access
2
by: bollinenivedi | last post by:
how can i insert and retrive mp3 files from sql server can send any one code for that pls to my mail (Email Removed)
3
by: deneushasler | last post by:
Hello my name is Juan Jose. My problem is as follows. When I try to insert a record into a table (access) to control DetailsView Visual Web Developer 2005, when I run the page and insert a record...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.