-
June 19th, 2011, 09:25 AM
#1
Invalid object name 'dual'.
Hi all, any help here would be appreciated. After spending an hour or two getting NHibernate to work I came across the error
(Toggle Plain Text)
Invalid object name 'dual'.
Can anybody shed light on what is causing this. The error occurs when updating/inserting into the DB. I'm using MySQL 2005 server and nhibernate 2.2 in vs2010. I'm new to databases so this has really stumped me. I've read that dual is an additional table generated by oracle but as I havnt called dual once within my code I'm unsure as to why I get the error or what it even is.
(Toggle Plain Text)
invalid object name 'dual'.
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.SqlClient.SqlException: Invalid object name 'dual'.
Source Error:
Line 50: {
Line 51: trans.Rollback();
Line 52: throw ex;
Line 53: }
Line 54: }
Source File: C:\Users\oem\Desktop\ProjectSite\ProjectSite\App_Code\DAO\GenericDAO.cs Line: 52
Stack Trace:
[SqlException (0x80131904): Invalid object name 'dual'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +109
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +126
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +239
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2311
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +310
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1034
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +242
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +20
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +144
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +10
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() +12
NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) +278
NHibernate.Id.SequenceGenerator.Generate(ISessionImplementor session, Object obj) +93
[GenericADOException: could not get next sequence value[SQL: select userID_seq.nextval from dual]]
ProjectSite.DAO.GenericDAO`1.InsertOrUpdate(T obj) in C:\Users\oem\Desktop\ProjectSite\ProjectSite\App_Code\DAO\GenericDAO.cs:52
ProjectSite.Pages.CreateProfile.btnSubmit_Click(Object sender, EventArgs e) in C:\Users\oem\Desktop\ProjectSite\ProjectSite\Pages\CreateProfile.aspx.cs:83
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +113
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5347
If you need to know any more let me know, thanks.
-
June 21st, 2011, 02:07 PM
#2
Re: Invalid object name 'dual'.
DUAL does not exist with SQL server.
DUAL is only for Oracle.
There is no DUAL table in SQL Server. In fact, you don't need one in SQL Server, as you can have a SELECT statement without a FROM clause.
For example, consider the following SELECT statement in Oracle:
SELECT 'Something'
FROM DUAL
In SQL Server, the same result can be obtained by the following command:
SELECT 'Something'
If you are porting some code from Oracle into SQL Server and if you don't want to remove all references to DUAL table, then just create a DUAL table in your database using the following commands:
CREATE TABLE DUAL
(
DUMMY varchar(1)
)
INSERT INTO DUAL (DUMMY) VALUES ('X')
(Source: http://vyaskn.tripod.com/oracle_sql_...quivalents.htm )
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|