why doesn't this work

B

Brian Henry

I get this error


Server Error in '/' Application.


IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
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:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Source Error:


Line 77: dbConnection.Open()
Line 78: End If
Line 79: gotValue = cmdGetPermissions.ExecuteScalar()
Line 80:
Line 81: dbConnection.Close()



Source File: c:\inetpub\wwwroot\reschiniFunctions.vb Line: 79

Stack Trace:


[OleDbException (0x80004005): IErrorInfo.GetDescription failed with
E_FAIL(0x80004005).]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41

System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteScalar() +185
localhost.reschiniFunctions.hasReadAccess(String formName) in
c:\inetpub\wwwroot\reschiniFunctions.vb:79
localhost.directory.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\directory.aspx.vb:149
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731








Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

ever time i call this function in vb.net

' checks to see if user is able to read data on that form
Public Function hasReadAccess(ByVal formName As String) As Boolean
Dim cmdGetPermissions As New OleDb.OleDbCommand("SELECT read from
userformaccess where userName = 'default' and formname = 'directory'")
Dim gotValue As Boolean = False
cmdGetPermissions.Connection = dbConnection
If dbConnection.State = ConnectionState.Closed Then
dbConnection.Open()
End If
gotValue = cmdGetPermissions.ExecuteScalar()
dbConnection.Close()
End Function

why is it giving me that error? the table its pulling from is set up like
this in access, all my other db commands work but this one... whats wrong
with it? the select statement works in access with no problem at all

userFormAccess table
=================
id autonumber primary key
userName text
read yes/no
write yes/no
delete yes/no
formName text
 
W

William Ryan

Wrap the ExecuteScalar in a try catch and see if you get any more info but I
think the problem is that username is a reserved word. Just for a test,
change it to _username and see if it works. This is the most likely culprit
b/c the connection is opening and you arne't getting permission exceptions.
In Access, if you use Date as a FieldName, it'll blow up on you, and I'm
guessing that username is the problem, it's defenitely a SQL Server reserved
word although SQLClient it pretty cool about it.

HTH
Let me know.

Cheers,

Bill
Brian Henry said:
I get this error


Server Error in '/' Application.


IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
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:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Source Error:


Line 77: dbConnection.Open()
Line 78: End If
Line 79: gotValue = cmdGetPermissions.ExecuteScalar()
Line 80:
Line 81: dbConnection.Close()



Source File: c:\inetpub\wwwroot\reschiniFunctions.vb Line: 79

Stack Trace:


[OleDbException (0x80004005): IErrorInfo.GetDescription failed with
E_FAIL(0x80004005).]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteScalar() +185
localhost.reschiniFunctions.hasReadAccess(String formName) in
c:\inetpub\wwwroot\reschiniFunctions.vb:79
localhost.directory.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\directory.aspx.vb:149
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731








Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

ever time i call this function in vb.net

' checks to see if user is able to read data on that form
Public Function hasReadAccess(ByVal formName As String) As Boolean
Dim cmdGetPermissions As New OleDb.OleDbCommand("SELECT read from
userformaccess where userName = 'default' and formname = 'directory'")
Dim gotValue As Boolean = False
cmdGetPermissions.Connection = dbConnection
If dbConnection.State = ConnectionState.Closed Then
dbConnection.Open()
End If
gotValue = cmdGetPermissions.ExecuteScalar()
dbConnection.Close()
End Function

why is it giving me that error? the table its pulling from is set up like
this in access, all my other db commands work but this one... whats wrong
with it? the select statement works in access with no problem at all

userFormAccess table
=================
id autonumber primary key
userName text
read yes/no
write yes/no
delete yes/no
formName text
 
B

Brian Henry

if i change the commandtext to just this
Dim cmdGetPermissions As New OleDb.OleDbCommand("SELECT read from
userformaccess")



it still crashes with the same exact error, and try catch gave me the same
information really... im really confused on this because im useing a similar
statement in a diffrent place and it works fine... what exactly does that
error mean?!

William Ryan said:
Wrap the ExecuteScalar in a try catch and see if you get any more info but I
think the problem is that username is a reserved word. Just for a test,
change it to _username and see if it works. This is the most likely culprit
b/c the connection is opening and you arne't getting permission exceptions.
In Access, if you use Date as a FieldName, it'll blow up on you, and I'm
guessing that username is the problem, it's defenitely a SQL Server reserved
word although SQLClient it pretty cool about it.

HTH
Let me know.

Cheers,

Bill
Brian Henry said:
I get this error


Server Error in '/' Application.


IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
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:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Source Error:


Line 77: dbConnection.Open()
Line 78: End If
Line 79: gotValue = cmdGetPermissions.ExecuteScalar()
Line 80:
Line 81: dbConnection.Close()



Source File: c:\inetpub\wwwroot\reschiniFunctions.vb Line: 79

Stack Trace:


[OleDbException (0x80004005): IErrorInfo.GetDescription failed with
E_FAIL(0x80004005).]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteScalar() +185
localhost.reschiniFunctions.hasReadAccess(String formName) in
c:\inetpub\wwwroot\reschiniFunctions.vb:79
localhost.directory.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\directory.aspx.vb:149
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731








Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

ever time i call this function in vb.net

' checks to see if user is able to read data on that form
Public Function hasReadAccess(ByVal formName As String) As Boolean
Dim cmdGetPermissions As New OleDb.OleDbCommand("SELECT read from
userformaccess where userName = 'default' and formname = 'directory'")
Dim gotValue As Boolean = False
cmdGetPermissions.Connection = dbConnection
If dbConnection.State = ConnectionState.Closed Then
dbConnection.Open()
End If
gotValue = cmdGetPermissions.ExecuteScalar()
dbConnection.Close()
End Function

why is it giving me that error? the table its pulling from is set up like
this in access, all my other db commands work but this one... whats wrong
with it? the select statement works in access with no problem at all

userFormAccess table
=================
id autonumber primary key
userName text
read yes/no
write yes/no
delete yes/no
formName text
 
B

Brian Henry

i figured it out with your help, read was a reserved word which was causeing
the crash, didn't even think about reserved words...


William Ryan said:
Wrap the ExecuteScalar in a try catch and see if you get any more info but I
think the problem is that username is a reserved word. Just for a test,
change it to _username and see if it works. This is the most likely culprit
b/c the connection is opening and you arne't getting permission exceptions.
In Access, if you use Date as a FieldName, it'll blow up on you, and I'm
guessing that username is the problem, it's defenitely a SQL Server reserved
word although SQLClient it pretty cool about it.

HTH
Let me know.

Cheers,

Bill
Brian Henry said:
I get this error


Server Error in '/' Application.


IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
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:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Source Error:


Line 77: dbConnection.Open()
Line 78: End If
Line 79: gotValue = cmdGetPermissions.ExecuteScalar()
Line 80:
Line 81: dbConnection.Close()



Source File: c:\inetpub\wwwroot\reschiniFunctions.vb Line: 79

Stack Trace:


[OleDbException (0x80004005): IErrorInfo.GetDescription failed with
E_FAIL(0x80004005).]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteScalar() +185
localhost.reschiniFunctions.hasReadAccess(String formName) in
c:\inetpub\wwwroot\reschiniFunctions.vb:79
localhost.directory.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\directory.aspx.vb:149
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731








Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

ever time i call this function in vb.net

' checks to see if user is able to read data on that form
Public Function hasReadAccess(ByVal formName As String) As Boolean
Dim cmdGetPermissions As New OleDb.OleDbCommand("SELECT read from
userformaccess where userName = 'default' and formname = 'directory'")
Dim gotValue As Boolean = False
cmdGetPermissions.Connection = dbConnection
If dbConnection.State = ConnectionState.Closed Then
dbConnection.Open()
End If
gotValue = cmdGetPermissions.ExecuteScalar()
dbConnection.Close()
End Function

why is it giving me that error? the table its pulling from is set up like
this in access, all my other db commands work but this one... whats wrong
with it? the select statement works in access with no problem at all

userFormAccess table
=================
id autonumber primary key
userName text
read yes/no
write yes/no
delete yes/no
formName text
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top