I'd like to request that this thread be continued on the NHUSERS forum ( http://groups.google.com/group/nhusers/) where its really more appropriate. This list is actually for the discussion of development *of* NHibernate rather than development *with* NHibernate.
Thanks, -Steve B. Steve Bohlen [email protected] http://blog.unhandled-exceptions.com http://twitter.com/sbohlen On Mon, Nov 26, 2012 at 3:25 PM, Paul Chapman <[email protected]>wrote: > I spent an entire evening looking at that and failed to notice, thanks > anyway - that has at least got rid of that error - it is now giving me; > Incorrect syntax near '@Email'. > > > On Monday, November 26, 2012 1:31:42 PM UTC, Richard Wilde wrote: > >> Are you missing:- >> >> >> >> query.SetString("RefreshToken ", “what ever your token is”); >> >> >> >> Rippo >> >> >> >> >> >> *From:* nhibernate-...@**googlegroups.com [mailto:nhibernate-** >> [email protected]] *On Behalf Of *Paul Chapman >> >> *Sent:* 25 November 2012 22:29 >> *To:* nhibernate-...@**googlegroups.com >> >> *Subject:* [nhibernate-development] could not execute native bulk >> manipulation with an inner exception of 'The given key was not present in >> the dictionary' when executing SQL 2008 Stored Procedure >> >> >> >> I get the following error when executing a stored procedure >> >> >> >> *could not execute native bulk manipulation query:exec >> EmailAuthorizationsInsert @Id=:Id @Email=:Email @AccessToken=:AccessToken >> @Expiration=:Expiration @Issued=:Issued @RefreshToken=:RefreshToken[SQL: >> SQL not available]* >> >> >> >> Inner Exception is >> >> >> >> *The given key was not present in the dictionary* >> >> >> >> hibernate.cfg.xml >> >> >> >> <?xml version="1.0" encoding="**utf-8" ?> >> >> <hibernate-configuration xmlns**="urn:nhibernate-**configuration-2.2"> >> >> <session-factory> >> >> <property >> name="connection**.provider">NHibernate.**Connection.**DriverConnectionProvider</prop**erty> >> >> <property >> name="dialect">N**Hibernate.Dialect.**MsSql2008Dialect</property> >> >> <property >> name="connection**.driver_class">NHibernate.**Driver.SqlClientDriver</proper**ty> >> >> <property name="connection**.connection_string">Data >> **Source=pc-acer\dev;Initial **Catalog=Email;Integrated >> **Security=True</property> >> >> <property name="show_sql">**true</property> >> >> </session-factory> >> >> </hibernate-configuration> >> >> >> >> EmailAuthorization.hbm.xml >> >> >> >> <?xml version="1.0" encoding="**utf-8" ?> >> >> <hibernate-mapping xmlns="urn:**nhibernate-mapping-2.2" >> assemb**ly="GoogleEmailClient" >> namespa**ce="GoogleEmailClient.**BusinessObjects"> >> >> <class name="EmailAuthorizat**ion" table="EmailAuthorization**s"> >> >> <id name="Id"> >> >> <generator class="guid" **/> >> >> </id> >> >> <property name="Email" /> >> >> <property name="AccessToke**n" /> >> >> <property name="Expiration**" /> >> >> <property name="Issued" /> >> >> <property name="RefreshTok**en" /> >> >> </class> >> >> </hibernate-mapping> >> >> >> >> Code to execute Stored Procedure >> >> >> >> ISession session =** NHibernateHelper.**GetCurrentSession(); >> >> IQuery query = **session.CreateSQLQuery("exec >> **EmailAuthorizationsInsert @Id=**:Id @Email=:Email >> @**AccessToken=:AccessToken @**Expiration=:Expiration @**Issued=:Issued >> @RefreshToken=:**RefreshToken"); >> >> query.SetGuid("Id"**, Guid.NewGuid()); >> >> query.SetString("**Email", user); >> >> query.SetString("**AccessToken", grantedAccess.**AccessToken); >> >> >> query.SetDateTime(**"Expiration",Convert.**ToDateTime(grantedAccess.**AccessTokenExpirationUtc)); >> >> query.SetDateTime(**"Issued", >> Convert.ToDateTime(**grantedAccess.**AccessTokenIssueDateUtc)); >> >> query.**ExecuteUpdate(); >> >> >> >> Stored Procedure being executed >> >> >> >> CREATE PROCEDURE [dbo].[**EmailAuthorizationsInsert] >> >> @ID ** >> UniqueIdentifier, >> >> @Email ** VarChar(MAX), >> >> @AccessToken VarChar(MAX), >> >> @Expiration DateTime, >> >> @Issued ** DateTime, >> >> @RefreshToken VarChar(MAX) >> >> AS >> >> BEGIN >> >> SET NOCOUNT ON; >> >> >> >> INSERT INTO EmailAuthorizations >> >> (Email >> >> , AccessToken >> >> , Expiration >> >> , Issued >> >> , RefreshToken) >> >> VALUES (@Email >> >> ** , @AccessToken >> >> ** , @Expiration >> >> ** , @Issued >> >> ** , @RefreshToken) >> >> END >> >> >> >> >> >> And for completeness the table definition >> >> >> >> USE [Email] >> >> GO >> >> >> >> /****** Object: Table [dbo].[EmailAuthorizations] Script Date: >> 11/25/2012 22:28:04 ******/ >> >> SET ANSI_NULLS ON >> >> GO >> >> >> >> SET QUOTED_IDENTIFIER ON >> >> GO >> >> >> >> SET ANSI_PADDING ON >> >> GO >> >> >> >> CREATE TABLE [dbo].[EmailAuthorizations]( >> >> [ID] [uniqueidentifier] NOT NULL, >> >> [Email] [varchar](max) NOT NULL, >> >> [AccessToken] [varchar](max) NOT NULL, >> >> [Expiration] [datetime] NOT NULL, >> >> [Issued] [datetime] NOT NULL, >> >> [RefreshToken] [varchar](max) NOT NULL >> >> ) ON [PRIMARY] >> >> >> >> GO >> >> >> >> SET ANSI_PADDING OFF >> >> GO >> >> >> >> Any ideas >> >> >> >> Thanks in advance >> >
