473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

sql a date field from access in .net

3
I get an error meessage and a crash on my OleDbDataAdapter from the following code trying to call up record meeting a simple date criteria. What am I doing wrong. Been on this problem for a week now. Thanks

Dim DBConnect As OleDb.OleDbConnection
Dim DBAdapt As OleDb.OleDbDataAdapter ''''''
Dim SQLstatement As String
Dim txtvalue As Date
Dim MyDataReader As OleDbDataReader
Dim MyCommand As New OleDbCommand(SQLstatement, DBConnect)
Dim Ds As New DataSet

txtvalue = #9/1/2006#
DBConnect = New OleDb.OleDbConnection("provider=microsoft.Jet.OLED B.4.0; Data Source=C:\vatrix\DataSampe\SampData.mdb")
DBConnect.Open()
SQLstatement = "select * from SampData WHERE DateField = #" & txtvalue.ToShortDateString & "#"
DBAdapt = New OleDbDataAdapter(SQLstatement, DBConnect)
DBCommand = New OleDb.OleDbCommand(SQLstatement, DBConnect)
DBAdapt.Fill(Ds, "SampData")
DBConnect.Close()
DataGrid1.DataSource = DBDataSet
With DataGrid1
DataGrid1.Refresh()
.CaptionText = "data"
.AllowSorting = True
.AlternatingBackColor = System.Drawing.Color.Bisque
.SetDataBinding(Ds, "SampData")
End With

End Sub
Sep 25 '06 #1
0 961

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

Similar topics

16
by: jason | last post by:
I'm tearing out my hair here: ACCESS 2000: When I attempt to overwrite a date in my date field with a new user selected valid date eg: 05/23/99 my date field changes to the TIME I updated the...
3
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able...
3
by: Mike Dundee | last post by:
I am importing data into a new database (the database still has to be set up) and have a problem. The comma delimited text files I am importing have four fields containing date and date/times. ...
10
by: Kenneth | last post by:
I have a Query that consist of a lot of different sales data, and one of the colums are different date. The date goes from 1jan2003 til 31jan2003. in this Query I only want the salesdata for...
3
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
2
by: hardik | last post by:
hi friends, i am really surprized the way access behaves in date fields i mean it's all ok when you have us time zone or us servers but if you have diffrent timezone like uk then access creates...
1
by: Jimmy | last post by:
I'm trying to run a query that will show only records where the year in a date field equals the current year: SELECT tblSideJob.SideJobID, tblSideJob.Date FROM tblSideJob WHERE...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.