Showing posts with label oledbexception. Show all posts
Showing posts with label oledbexception. Show all posts

Thursday, March 22, 2012

OleDbException executing reader on Access stored view

I had a strange error in asp.net when try to execute a simple select
statement like "Select * From ViewName" if the stored view contains a where
clause.
The connection is made to an Access database using System.Data.OleDb objects
and Jet 4.0 oledb provider.
The same code works fine in windows form application.
Removing the where clause from the stored view or adding ASPNET user into
"Power Users" or "Administrators" groups, all works also in asp.net.
My first idea was a security/permission problem, but it is strange that all
properly works without the where clause.

The error happens on Win xp sp2 with .NET 1.1 sp1 and don't happens on Win
xp sp1 with .NET 1.1 sp1.

???
Some ideas?

Thanks so much for your help, Marco.Exceptions have messages. Odd that you danced all around the exception
without managing to mention what exactly it IS. How about it?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Marco Frontini" <iunknown@.libero.it> wrote in message
news:ucslziM%23EHA.2156@.TK2MSFTNGP10.phx.gbl...
>I had a strange error in asp.net when try to execute a simple select
>statement like "Select * From ViewName" if the stored view contains a
>where clause.
> The connection is made to an Access database using System.Data.OleDb
> objects and Jet 4.0 oledb provider.
> The same code works fine in windows form application.
> Removing the where clause from the stored view or adding ASPNET user into
> "Power Users" or "Administrators" groups, all works also in asp.net.
> My first idea was a security/permission problem, but it is strange that
> all properly works without the where clause.
> The error happens on Win xp sp2 with .NET 1.1 sp1 and don't happens on Win
> xp sp1 with .NET 1.1 sp1.
> ???
> Some ideas?
> Thanks so much for your help, Marco.
A generic "Internal OLE Automation Error" isn't so usefull.

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> ha scritto nel messaggio
news:O8pWebN%23EHA.1296@.TK2MSFTNGP10.phx.gbl...
> Exceptions have messages. Odd that you danced all around the exception
> without managing to mention what exactly it IS. How about it?
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Neither a follower nor a lender be.
> "Marco Frontini" <iunknown@.libero.it> wrote in message
> news:ucslziM%23EHA.2156@.TK2MSFTNGP10.phx.gbl...
>>I had a strange error in asp.net when try to execute a simple select
>>statement like "Select * From ViewName" if the stored view contains a
>>where clause.
>> The connection is made to an Access database using System.Data.OleDb
>> objects and Jet 4.0 oledb provider.
>> The same code works fine in windows form application.
>> Removing the where clause from the stored view or adding ASPNET user into
>> "Power Users" or "Administrators" groups, all works also in asp.net.
>> My first idea was a security/permission problem, but it is strange that
>> all properly works without the where clause.
>>
>> The error happens on Win xp sp2 with .NET 1.1 sp1 and don't happens on
>> Win xp sp1 with .NET 1.1 sp1.
>>
>> ???
>> Some ideas?
>>
>> Thanks so much for your help, Marco.
>>

OleDbException executing reader on Access stored view

I had a strange error in asp.net when try to execute a simple select
statement like "Select * From ViewName" if the stored view contains a where
clause.
The connection is made to an Access database using System.Data.OleDb objects
and Jet 4.0 oledb provider.
The same code works fine in windows form application.
Removing the where clause from the stored view or adding ASPNET user into
"Power Users" or "Administrators" groups, all works also in asp.net.
My first idea was a security/permission problem, but it is strange that all
properly works without the where clause.
The error happens on Win xp sp2 with .NET 1.1 sp1 and don't happens on Win
xp sp1 with .NET 1.1 sp1.
'?
Some ideas?
Thanks so much for your help, Marco.Exceptions have messages. Odd that you danced all around the exception
without managing to mention what exactly it IS. How about it?
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"Marco Frontini" <iunknown@.libero.it> wrote in message
news:ucslziM%23EHA.2156@.TK2MSFTNGP10.phx.gbl...
>I had a strange error in asp.net when try to execute a simple select
>statement like "Select * From ViewName" if the stored view contains a
>where clause.
> The connection is made to an Access database using System.Data.OleDb
> objects and Jet 4.0 oledb provider.
> The same code works fine in windows form application.
> Removing the where clause from the stored view or adding ASPNET user into
> "Power Users" or "Administrators" groups, all works also in asp.net.
> My first idea was a security/permission problem, but it is strange that
> all properly works without the where clause.
> The error happens on Win xp sp2 with .NET 1.1 sp1 and don't happens on Win
> xp sp1 with .NET 1.1 sp1.
> '?
> Some ideas?
> Thanks so much for your help, Marco.
>
A generic "Internal OLE Automation Error" isn't so usefull.
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> ha scritto nel messaggio
news:O8pWebN%23EHA.1296@.TK2MSFTNGP10.phx.gbl...
> Exceptions have messages. Odd that you danced all around the exception
> without managing to mention what exactly it IS. How about it?
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Neither a follower nor a lender be.
> "Marco Frontini" <iunknown@.libero.it> wrote in message
> news:ucslziM%23EHA.2156@.TK2MSFTNGP10.phx.gbl...
>

OleDbException: Too many arguments.

Hi,

I'm passing around 30 arguments to a stored procedure, and
I got the following error (see below).
It works fine if I narrow down to around 25 args. Is there
any workaround to bypass this exception, I need to pass 30
of them to my stored procedure. Thanks.
I'm using Framework 1.0.

--------
Too many arguments.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Too
many arguments.

Source Error:

Line 663:
Line 664: 'execute SQL
Line 665: oCmd.ExecuteNonQuery()
Line 666:
Line 667: 'Catch exc As OleDbException
--------If you have any return parameters, they must be specified first. You should
declare any return parameters before you start adding input parameters. That
is commonly the reason for this error. Also, make sure that the order in
which you are adding your parameters match the order in the stored
procedure.

HTH,
Bill P.

"jn" <anonymous@.discussions.microsoft.com> wrote in message
news:001001c3aec9$13cedf10$a501280a@.phx.gbl...
> Hi,
> I'm passing around 30 arguments to a stored procedure, and
> I got the following error (see below).
> It works fine if I narrow down to around 25 args. Is there
> any workaround to bypass this exception, I need to pass 30
> of them to my stored procedure. Thanks.
> I'm using Framework 1.0.
> --------
> Too many arguments.
> Description: An unhandled exception occurred during the
> execution of the current web request. Please review the
> stack trace for more information about the error and where
> it originated in the code.
> Exception Details: System.Data.OleDb.OleDbException: Too
> many arguments.
> Source Error:
>
> Line 663:
> Line 664: 'execute SQL
> Line 665: oCmd.ExecuteNonQuery()
> Line 666:
> Line 667: 'Catch exc As OleDbException
> --------
arg, I found out it's Visual FoxPro problem (I'm using VFP
as the backend database), it just won't take more than 28
parameters. Thanks, Bill, for looking into my problem
though.

>--Original Message--
>If you have any return parameters, they must be specified
first. You should
>declare any return parameters before you start adding
input parameters. That
>is commonly the reason for this error. Also, make sure
that the order in
>which you are adding your parameters match the order in
the stored
>procedure.
>HTH,
>Bill P.
>
>"jn" <anonymous@.discussions.microsoft.com> wrote in
message
>news:001001c3aec9$13cedf10$a501280a@.phx.gbl...
>> Hi,
>>
>> I'm passing around 30 arguments to a stored procedure,
and
>> I got the following error (see below).
>> It works fine if I narrow down to around 25 args. Is
there
>> any workaround to bypass this exception, I need to pass
30
>> of them to my stored procedure. Thanks.
>> I'm using Framework 1.0.
>>
>> --------
>> Too many arguments.
>> Description: An unhandled exception occurred during the
>> execution of the current web request. Please review the
>> stack trace for more information about the error and
where
>> it originated in the code.
>>
>> Exception Details: System.Data.OleDb.OleDbException: Too
>> many arguments.
>>
>> Source Error:
>>
>>
>> Line 663:
>> Line 664: 'execute SQL
>> Line 665: oCmd.ExecuteNonQuery()
>> Line 666:
>> Line 667: 'Catch exc As OleDbException
>> --------
>>
>
>.

OleDbException: Data type mismatch in criteria expression.

Using Access db with VS2008 (ASP.NET/VB.NET)...
On the INSERT command I get this error: System.Data.OleDb.OleDbException:
Data type mismatch in criteria expression.
I haven't found a solution yet in my research. Any idea what I might be
missing?
**************
Datasource setup as follows:
<asp:AccessDataSource ID="AccessDataSource1"
runat="server"
DataFile="~/BeachFuneral.mdb"
InsertCommand="INSERT INTO [ObitComments]
([ObitId], [CommentBy], [CommentEmail], [CommentRelation],
[CommentApproved], [CommentDateTime], [ObitComment]) VALUES (?, ?, ?, ?, ?,
?, ?)" >
<InsertParameters>
<asp:Parameter Name="ObitId" />
<asp:Parameter Name="CommentBy" />
<asp:Parameter Name="CommentEmail" />
<asp:Parameter Name="CommentRelation" />
<asp:Parameter Name="CommentApproved" />
<asp:Parameter Name="CommentDateTime" />
<asp:Parameter Name="ObitComment" />
</InsertParameters>
</asp:AccessDataSource>
**************
Code to insert as follows:
With Me.AccessDataSource1
.InsertParameters("ObitId").DefaultValue =
Request.QueryString("Id")
.InsertParameters("CommentBy").DefaultValue =
Me.txtFullName.Text
.InsertParameters("CommentEmail").DefaultValue =
Me.txtEmail.Text
.InsertParameters("CommentRelation").DefaultValue =
Me.txtRelationship.Text
.InsertParameters("CommentApproved").DefaultValue = True
.InsertParameters("CommentDateTime").DefaultValue = Now.ToString
.InsertParameters("ObitComment").DefaultValue =
Me.txtComment.Text
End With
Try
Me.AccessDataSource1.Insert()
Catch ex As Exception
Response.Write(ex.ToString)
Exit Sub
Finally
' if ok then move on...
Response.Redirect("Obit.aspx?Id=" & Request.QueryString("Id"))
End TryYou have not identified what data types your database is using, either in
this message, or in your code. However, you are attemtping to insert all
string values (text data type), with the exception of one field
(CommentApproved) which you are inserting a boolean value into. So, unless
all of the fields in the table are text except for that one, you would
certainly get that exception.
HTH,
Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
"Bobby Edward" <test@.test.com> wrote in message
news:OkUo0QofIHA.288@.TK2MSFTNGP02.phx.gbl...
> Using Access db with VS2008 (ASP.NET/VB.NET)...
> On the INSERT command I get this error: System.Data.OleDb.OleDbException:
> Data type mismatch in criteria expression.
> I haven't found a solution yet in my research. Any idea what I might be
> missing?
> **************
> Datasource setup as follows:
> <asp:AccessDataSource ID="AccessDataSource1"
> runat="server"
> DataFile="~/BeachFuneral.mdb"
> InsertCommand="INSERT INTO [ObitComments]
> ([ObitId], [CommentBy], [CommentEmail], [CommentRelation],
> [CommentApproved], [CommentDateTime], [ObitComment]) VALUES (?, ?, ?, ?,
> ?, ?, ?)" >
> <InsertParameters>
> <asp:Parameter Name="ObitId" />
> <asp:Parameter Name="CommentBy" />
> <asp:Parameter Name="CommentEmail" />
> <asp:Parameter Name="CommentRelation"
> />
> <asp:Parameter Name="CommentApproved"
> />
> <asp:Parameter Name="CommentDateTime"
> />
> <asp:Parameter Name="ObitComment" />
> </InsertParameters>
> </asp:AccessDataSource>
> **************
> Code to insert as follows:
> With Me.AccessDataSource1
> .InsertParameters("ObitId").DefaultValue =
> Request.QueryString("Id")
> .InsertParameters("CommentBy").DefaultValue =
> Me.txtFullName.Text
> .InsertParameters("CommentEmail").DefaultValue =
> Me.txtEmail.Text
> .InsertParameters("CommentRelation").DefaultValue =
> Me.txtRelationship.Text
> .InsertParameters("CommentApproved").DefaultValue = True
> .InsertParameters("CommentDateTime").DefaultValue =
> Now.ToString
> .InsertParameters("ObitComment").DefaultValue =
> Me.txtComment.Text
> End With
> Try
> Me.AccessDataSource1.Insert()
> Catch ex As Exception
> Response.Write(ex.ToString)
> Exit Sub
> Finally
> ' if ok then move on...
> Response.Redirect("Obit.aspx?Id=" & Request.QueryString("Id"))
> End Try
>
>