Hi,
I've got a problem accessing a ms-access db with a sql statement like
this:
SELECT * FROM laTable WHERE laDate = #05/21/2004# ;
with asp.net (vb code)
laTable contains a "laDate" datetime field .
Request works in ms-access, but not in asp.net,
I get "internal automation error" on line:
OleDbDataAdapt. ExecuteReader()
I can't understand...
If I run a request with a "where" on something other than a date stuff,
it works both in access and asp.
I've tried some other things:
with " ' " => donnees incompatibles dans le critere
with date and time => automation error
with LIKE instead of " = " => automation error
I'm busy with that since now a few days...
thanks for any help
-- yannick --
PS:
config:
access 2000 database / asp.net framework 1.1 / VS.net
code:
requete = "SELECT * FROM laTable WHERE laDate = #05/21/2004#
OleData_prod.Se lectCommand.Con nection = OLE_dataBase
OleData_prod.Se lectCommand.Com mandType = CommandType.Tex t
OleData_prod.Se lectCommand.Com mandText = requete
OleData_prod.Se lectCommand.Con nection.Open()
OleData_prod.Se lectCommand.Exe cuteReader()
OleData_prod.Se lectCommand.Con nection.Close()
OleData_prod.Fi ll(leDataset) 12 27025
Try using parameters instead.
Dim cn As New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data
Source=" & Server.MapPath( ConfigurationSe ttings.AppSetti ngs("dbPath")))
Dim cmd As New OleDbCommand("S ELECT * FROM laTable WHERE laDate = @laDate",
cn)
cmd.Parameters. Add(New OleDbParameter( "@laDate", OleDbType.Date) ).Value =
New DateTime(2004, 5, 21)
HTH,
Greg
"Yannick" <po****@nowhere .com> wrote in message
news:MP******** *************** *@news.wanadoo. fr... Hi,
I've got a problem accessing a ms-access db with a sql statement like this:
SELECT * FROM laTable WHERE laDate = #05/21/2004# ; with asp.net (vb code)
laTable contains a "laDate" datetime field .
Request works in ms-access, but not in asp.net, I get "internal automation error" on line: OleDbDataAdapt. ExecuteReader()
I can't understand...
If I run a request with a "where" on something other than a date stuff, it works both in access and asp.
I've tried some other things: with " ' " => donnees incompatibles dans le critere with date and time => automation error with LIKE instead of " = " => automation error
I'm busy with that since now a few days...
thanks for any help
-- yannick --
PS: config: access 2000 database / asp.net framework 1.1 / VS.net
code: requete = "SELECT * FROM laTable WHERE laDate = #05/21/2004#
OleData_prod.Se lectCommand.Con nection = OLE_dataBase OleData_prod.Se lectCommand.Com mandType = CommandType.Tex t OleData_prod.Se lectCommand.Com mandText = requete
OleData_prod.Se lectCommand.Con nection.Open()
OleData_prod.Se lectCommand.Exe cuteReader()
OleData_prod.Se lectCommand.Con nection.Close()
OleData_prod.Fi ll(leDataset)
hmm just something to try, have u checked other dates yet ?
something more in the line that works for d/m/y and m/d/y
as in dont use 21 incase its a datetime format error that you are
encountering.. try #05/05/2004# and see if u get an error...
"Yannick" <po****@nowhere .com> wrote in message
news:MP******** *************** *@news.wanadoo. fr... Hi,
I've got a problem accessing a ms-access db with a sql statement like this:
SELECT * FROM laTable WHERE laDate = #05/21/2004# ; with asp.net (vb code)
laTable contains a "laDate" datetime field .
Request works in ms-access, but not in asp.net, I get "internal automation error" on line: OleDbDataAdapt. ExecuteReader()
I can't understand...
If I run a request with a "where" on something other than a date stuff, it works both in access and asp.
I've tried some other things: with " ' " => donnees incompatibles dans le critere with date and time => automation error with LIKE instead of " = " => automation error
I'm busy with that since now a few days...
thanks for any help
-- yannick --
PS: config: access 2000 database / asp.net framework 1.1 / VS.net
code: requete = "SELECT * FROM laTable WHERE laDate = #05/21/2004#
OleData_prod.Se lectCommand.Con nection = OLE_dataBase OleData_prod.Se lectCommand.Com mandType = CommandType.Tex t OleData_prod.Se lectCommand.Com mandText = requete
OleData_prod.Se lectCommand.Con nection.Open()
OleData_prod.Se lectCommand.Exe cuteReader()
OleData_prod.Se lectCommand.Con nection.Close()
OleData_prod.Fi ll(leDataset)
hmm just something to try, have u checked other dates yet ?
something more in the line that works for d/m/y and m/d/y
as in dont use 21 incase its a datetime format error that you are
encountering.. try #05/05/2004# and see if u get an error...
"Yannick" <po****@nowhere .com> wrote in message
news:MP******** *************** *@news.wanadoo. fr... Hi,
I've got a problem accessing a ms-access db with a sql statement like this:
SELECT * FROM laTable WHERE laDate = #05/21/2004# ; with asp.net (vb code)
laTable contains a "laDate" datetime field .
Request works in ms-access, but not in asp.net, I get "internal automation error" on line: OleDbDataAdapt. ExecuteReader()
I can't understand...
If I run a request with a "where" on something other than a date stuff, it works both in access and asp.
I've tried some other things: with " ' " => donnees incompatibles dans le critere with date and time => automation error with LIKE instead of " = " => automation error
I'm busy with that since now a few days...
thanks for any help
-- yannick --
PS: config: access 2000 database / asp.net framework 1.1 / VS.net
code: requete = "SELECT * FROM laTable WHERE laDate = #05/21/2004#
OleData_prod.Se lectCommand.Con nection = OLE_dataBase OleData_prod.Se lectCommand.Com mandType = CommandType.Tex t OleData_prod.Se lectCommand.Com mandText = requete
OleData_prod.Se lectCommand.Con nection.Open()
OleData_prod.Se lectCommand.Exe cuteReader()
OleData_prod.Se lectCommand.Con nection.Close()
OleData_prod.Fi ll(leDataset)
Hi,
Here is sample using the northwind database.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
If Not Me.IsPostBack Then
BindDataToGrid( )
End If
End Sub
Private Sub BindDataToGrid( )
Dim strConn As String
Dim conn As OleDb.OleDbConn ection
Dim cmdOrders As OleDb.OleDbComm and
Dim dr As OleDb.OleDbData Reader
strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"
strConn &= "Data Source = C:\Northwind.md b;"
conn = New OleDb.OleDbConn ection(strConn)
cmdOrders = New OleDb.OleDbComm and("Select OrderID, OrderDate,
ShipVia from Orders where OrderDate = #01/01/1998#", conn)
conn.Open()
dr = cmdOrders.Execu teReader(Comman dBehavior.Close Connection)
DataGrid1.DataS ource = dr
DataGrid1.DataB ind()
End Sub
Ken
---------------------------------
"Yannick" <po****@nowhere .com> wrote in message
news:MP******** *************** *@news.wanadoo. fr: Hi,
I've got a problem accessing a ms-access db with a sql statement like this:
SELECT * FROM laTable WHERE laDate = #05/21/2004# ; with asp.net (vb code)
laTable contains a "laDate" datetime field .
Request works in ms-access, but not in asp.net, I get "internal automation error" on line: OleDbDataAdapt. ExecuteReader()
I can't understand...
If I run a request with a "where" on something other than a date stuff, it works both in access and asp.
I've tried some other things: with " ' " => donnees incompatibles dans le critere with date and time => automation error with LIKE instead of " = " => automation error
I'm busy with that since now a few days...
thanks for any help
-- yannick --
PS: config: access 2000 database / asp.net framework 1.1 / VS.net
code: requete = "SELECT * FROM laTable WHERE laDate = #05/21/2004#
OleData_prod.Se lectCommand.Con nection = OLE_dataBase OleData_prod.Se lectCommand.Com mandType = CommandType.Tex t OleData_prod.Se lectCommand.Com mandText = requete
OleData_prod.Se lectCommand.Con nection.Open()
OleData_prod.Se lectCommand.Exe cuteReader()
OleData_prod.Se lectCommand.Con nection.Close()
OleData_prod.Fi ll(leDataset)
--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus ( http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
try putting the date in single quotes? Where laData ='#5/21/2004#'
"Yannick" <po****@nowhere .com> wrote in message
news:MP******** *************** *@news.wanadoo. fr... Hi,
I've got a problem accessing a ms-access db with a sql statement like this:
SELECT * FROM laTable WHERE laDate = #05/21/2004# ; with asp.net (vb code)
laTable contains a "laDate" datetime field .
Request works in ms-access, but not in asp.net, I get "internal automation error" on line: OleDbDataAdapt. ExecuteReader()
I can't understand...
If I run a request with a "where" on something other than a date stuff, it works both in access and asp.
I've tried some other things: with " ' " => donnees incompatibles dans le critere with date and time => automation error with LIKE instead of " = " => automation error
I'm busy with that since now a few days...
thanks for any help
-- yannick --
PS: config: access 2000 database / asp.net framework 1.1 / VS.net
code: requete = "SELECT * FROM laTable WHERE laDate = #05/21/2004#
OleData_prod.Se lectCommand.Con nection = OLE_dataBase OleData_prod.Se lectCommand.Com mandType = CommandType.Tex t OleData_prod.Se lectCommand.Com mandText = requete
OleData_prod.Se lectCommand.Con nection.Open()
OleData_prod.Se lectCommand.Exe cuteReader()
OleData_prod.Se lectCommand.Con nection.Close()
OleData_prod.Fi ll(leDataset)
----- Original Message -----
From: "Rob T" <RT*********@DO NTwalchemSPAM.c om>
|
| try putting the date in single quotes? Where laData ='#5/21/2004#'
Access recognizes values delimited with # as a Date type. SQL Server does not. SQL Server will *implicitly* convert a string
(delimited by single quotes) to a DATETIME value *only* if the format of the date matches the default DATETIME format setting for
SQL Server. This can be observed by executing "SELECT GETDATE()" from a Query Analyzer window. This typically returns in the ODBC
canonical format of "yyyy-mm-dd hh:mi:ss.mmm" (style = 121).
To ensure string date value can be used by SQL Server use the CONVERT() function on your string value (example style setting is
101 - USA format mm/dd/yyyy)...
WHERE laDate = CONVERT( DATETIME, '05/21/2004', 101)
See SQL Server Books Online, Transact-SQL Reference, CAST and CONVERT for more information and other style settings.
ChrisG
I get exactly the same error !
I find this really strange. Am I the only one in the universe to get
that vb.net's behaviour ?!
--yannick--
In article <#N************ **@TK2MSFTNGP09 .phx.gbl>, you say... Try using parameters instead.
Dim cn As New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=" & Server.MapPath( ConfigurationSe ttings.AppSetti ngs("dbPath"))) Dim cmd As New OleDbCommand("S ELECT * FROM laTable WHERE laDate = @laDate", cn) cmd.Parameters. Add(New OleDbParameter( "@laDate", OleDbType.Date) ).Value = New DateTime(2004, 5, 21)
HTH, Greg
Yes, I've tried with dates like:
05/05/2004, 05-05-2004
I always get the error "internal automation error"
?!
--yannick--
In article <Oj************ **@TK2MSFTNGP12 .phx.gbl>, te**@test.com
says... hmm just something to try, have u checked other dates yet ? something more in the line that works for d/m/y and m/d/y as in dont use 21 incase its a datetime format error that you are encountering.. try #05/05/2004# and see if u get an error...
If I change my query to integrate your idea:
WHERE laDate = CONVERT( DATETIME, '05/21/2004', 101)
I get the error:
"La référence d'objet n'est pas définie à une instance d'un objet"
which can be translated to something like :
"Object reference not set to an instance of an object "
Any idea of what I can do ?
--yannick--
In article <OB************ **@tk2msftngp13 .phx.gbl>, ch***@gallucci. com
says... ----- Original Message ----- From: "Rob T" <RT*********@DO NTwalchemSPAM.c om> | | try putting the date in single quotes? Where laData ='#5/21/2004#' Access recognizes values delimited with # as a Date type. SQL Server doesnot. SQL Server will *implicitly* convert a string (delimited by single quotes) to a DATETIME value *only* if the format of the date matches the default DATETIME format setting for SQL Server. This can be observed by executing "SELECT GETDATE()" from a Query Analyzer window. This typically returns in the ODBC canonical format of "yyyy-mm-dd hh:mi:ss.mmm" (style = 121). To ensure string date value can be used by SQL Server use the CONVERT() function on your string value (example style setting is 101 - USA format mm/dd/yyyy)... WHERE laDate = CONVERT( DATETIME, '05/21/2004', 101) See SQL Server Books Online, Transact-SQL Reference, CAST and CONVERT formore information and other style settings. ChrisG
CONVERT only works with SQL server as mentioned by Chris.
I suggest (again) that you use parameters. :)
Greg
"Yannick" <po****@nowhere .com> wrote in message
news:MP******** *************** *@news.wanadoo. fr...
If I change my query to integrate your idea:
WHERE laDate = CONVERT( DATETIME, '05/21/2004', 101)
I get the error:
"La référence d'objet n'est pas définie à une instance d'un objet"
which can be translated to something like :
"Object reference not set to an instance of an object "
Any idea of what I can do ?
--yannick--
In article <OB************ **@tk2msftngp13 .phx.gbl>, ch***@gallucci. com
says... ----- Original Message ----- From: "Rob T" <RT*********@DO NTwalchemSPAM.c om> |
| try putting the date in single quotes? Where laData ='#5/21/2004#'
Access recognizes values delimited with # as a Date type. SQL Server does
not. SQL Server will *implicitly* convert a string (delimited by single quotes) to a DATETIME value *only* if the format of
the date matches the default DATETIME format setting for SQL Server. This can be observed by executing "SELECT GETDATE()" from a
Query Analyzer window. This typically returns in the ODBC canonical format of "yyyy-mm-dd hh:mi:ss.mmm" (style = 121).
To ensure string date value can be used by SQL Server use the CONVERT()
function on your string value (example style setting is 101 - USA format mm/dd/yyyy)...
WHERE laDate = CONVERT( DATETIME, '05/21/2004', 101)
See SQL Server Books Online, Transact-SQL Reference, CAST and CONVERT for
more information and other style settings. ChrisG This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Yann GAUTHERON |
last post by:
Hi,
ID_LOGIN is an integer
Can anyone say me if this :
WHERE index1=ID_LOGIN OR index2=ID_LOGIN
must be slower than those 2 queries :
|
by: Frederik |
last post by:
Hi all,
I'm building a C# application that uses a M$ Acces database. In one of
the queries I use something like the following:
SELECT id FROM mytable WHERE id IN (20, 12, 21, 14)
The result is fine, except that the order of the id's is not
preserved. It seems to be ordered ascending. How can I keep the order
I used as input?
|
by: Akhenaten |
last post by:
Probably something simple but all email I send via mail() is received
with an "unknown date" stamp. Am I missing something in my header?
Code as follows:
*****************************
<?php
$headers = <<<END
From: this@email.com
Date: $date
X-Mailer: PHP v$phpversion
|
by: Curious |
last post by:
Hi,
I have two columns defined as DateTime type in the Visual Designer,
i.e., Dataset.xsd.
In the grid to which the columns are bound, they're both displayed as
date, for instance, 5/23/2007. It seems that they're using the default
"short date" format.
I want to use the "long date" format to display the actual hour/minute/
|
by: Curious |
last post by:
Hi,
I have two columns in a grid defined as DateTime type.
Currently, they're both displayed in the format of "5/23/2007", for an
example. It seems that they're using the default "short date" format.
I want to use the format of, for an example, "5/23/2007 12:35:58 PM",
to include hour/minute/second to display one column (while keeping the
format of the other column as it is). Anyone can advise me on how to
| |
by: Curious |
last post by:
Hi,
I have a column in a grid defined as DateTime type.
Currently, it's displayed in the format of "5/23/2007", for an
example. It seems that it's using the default "short date" format.
I want to use the format of, for an example, "5/23/2007 12:35:58 PM",
to include hour/minute/second. Anyone can advise me on how to change
the format?
|
by: mkremkow |
last post by:
Hello all,
Access 2003 Windows PC:
I am trying to figure out why my Query isn't working. In this query, I want to get only those jobs that are still open and where at least one of four Yes/No fields is "Yes".
In my query, "Date Closed" field criteria "is null". My result is a listing of all jobs that have at least one of the four Yes/No fields, regardless of close date. Any suggestions?
Thanks!
|
by: saddist |
last post by:
Hello,
I have an access report with WHERE clause: "WHERE tMonth in (Forms!frmMain!txtMonths)"
when txtMonths = "7" (f.e.) it works just fine, but when I try to execute the code when txtMonths = "7,8" it displays empty report
Any idea what can be wrong?
|
by: Tim Mullin |
last post by:
Hello all,
I'm hoping to find an answer to a question I have using forms in Access 2007.
I have a form (source: table) that has three fields:
Start Date
Term (number of months)
End Date
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |