Parameter: @levels is missing from stored procedure

Oct 26, 2009 at 5:55 PM
Edited Oct 26, 2009 at 6:14 PM

HI im trying to create save methonds using nhydrate. when i try to save it gives me error "Parameter: @levels is missing from stored procedure"

this is the exact error message: "Parameter: @levels is missing from stored procedure: gen_IseitzCustomerSelectByIseitzCustomerSinglePk"

anybody can help me pls..

thanks 

Coordinator
Oct 26, 2009 at 6:14 PM

What do you mean "save methods"? You should not have to create anything. You should be able to call the persist method of any collection or object and the save is implicit. Can you send to me an example of what you are writing? See code below.

Customer customer = Customer.SelectUsingPK(1);
customer.Name = "NewName";
customer.Persist();

Oct 26, 2009 at 6:26 PM
Edited Oct 26, 2009 at 6:28 PM

yes i already created that: 
this is my code:

This is a new record. so the customerId is 0

int customerId;
                int.TryParse(this.Request["id"], out customerId);
                IseitzCustomer iseitzCustomer = IseitzCustomer.SelectUsingPK(customerId);
  th             if (iseitzCustomer == null)
                {
                    IseitzCustomerCollection iseitzCustomerCollection = new IseitzCustomerCollection();
                    iseitzCustomer = iseitzCustomerCollection.NewItem();
                    iseitzCustomer.Code = CustomerNoTextBox.Text;
                    iseitzCustomer.Name = CompanyNameTextBox.Text;
                    iseitzCustomer.StreetNo = StreetNoTextBox.Text;
                    iseitzCustomer.Street = StreetTextBox.Text;
                    iseitzCustomer.City = CityTextBox.Text;
                    iseitzCustomer.State = StateTextBox.Text;
                    iseitzCustomer.ZipCode = ZipCodeTextBox.Text;
                    iseitzCustomer.Country = CountryTextBox.Text;
                    iseitzCustomer.Phone = PhoneNoTextBox.Text;
                    iseitzCustomer.Fax = FaxNoTextBox.Text;
                    iseitzCustomer.Email = EmailTextBox.Text;
                    iseitzCustomer.Website = WebsiteTextBox.Text;
                    int customerTypeId;
                    int.TryParse(DropDownList.SelectedValue, out customerTypeId);
                    iseitzCustomer.CustomerTypeId = customerTypeId;
                    iseitzCustomerCollection.AddItem(iseitzCustomer);
                    iseitzCustomerCollection.Persist();
int customerId;
                int.TryParse(this.Request["id"], out customerId);
                IseitzCustomer iseitzCustomer = IseitzCustomer.SelectUsingPK(customerId);  --->> "it's stops in here and gets me error.."
                if (iseitzCustomer == null)
                {
                    IseitzCustomerCollection iseitzCustomerCollection = new IseitzCustomerCollection();
                    iseitzCustomer = iseitzCustomerCollection.NewItem();
                    iseitzCustomer.Code = CustomerNoTextBox.Text;
                    iseitzCustomer.Name = CompanyNameTextBox.Text;
                    iseitzCustomer.StreetNo = StreetNoTextBox.Text;
                    iseitzCustomer.Street = StreetTextBox.Text;
                    iseitzCustomer.City = CityTextBox.Text;
                    iseitzCustomer.State = StateTextBox.Text;
                    iseitzCustomer.ZipCode = ZipCodeTextBox.Text;
                    iseitzCustomer.Country = CountryTextBox.Text;
                    iseitzCustomer.Phone = PhoneNoTextBox.Text;
                    iseitzCustomer.Fax = FaxNoTextBox.Text;
                    iseitzCustomer.Email = EmailTextBox.Text;
                    iseitzCustomer.Website = WebsiteTextBox.Text;
                    int customerTypeId;
                    int.TryParse(DropDownList.SelectedValue, out customerTypeId);
                    iseitzCustomer.CustomerTypeId = customerTypeId;
                    iseitzCustomerCollection.AddItem(iseitzCustomer);

                    iseitzCustomerCollection.Persist();

 

thanks,
 john

 

Coordinator
Oct 26, 2009 at 9:21 PM

Please send your model (wsgen) file to chrisd@nhydrate.org. I will run this and determine what is wrong.

Oct 27, 2009 at 3:23 AM

i try to regenerate the code but my problem now is i can't open the wsgen file. im using vs2008sp1 :(

Coordinator
Oct 27, 2009 at 4:50 PM

Please download the latest version and regenerate. A problem loading a single item from a self-referencing table was corrected. As far as the model not opening, please send it to me or tell me what is the error you get.

Oct 27, 2009 at 9:53 PM

it gives me: 

package load failure

 

package 'Widgetsphere.VSCodeTools.VsCodeToolsPackage, VsCodeTools2008, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=e6fa5c0e89df995e8' has failed to load properly (GUID = {E6BF88AA-2787-406B-9709-4EB75135B55E})
Please contact package vendor for assistance. Application restart is recommended, due to possible environment corruption.
Would you like to disable loading this package in the future? You may use 'denv /resetskippkgs' to re-enable package loading. 

'

 

Oct 27, 2009 at 10:00 PM

i already run the model editor. i will try to install the new package. 

thanks codetools. :D 

Oct 27, 2009 at 10:20 PM

this is my new error when i try to rebuild the DAL:

Error 24 Cannot access protected member 'Widgetsphere.Core.DataAccess.BusinessCollectionPersistableBase.GetCommand<TEntity>(System.Data.Linq.DataContext, System.Data.Linq.Table<TEntity>, System.Linq.Expressions.Expression<System.Func<TEntity,bool>>)' via a qualifier of type 'Widgetsphere.Core.DataAccess.BusinessCollectionPersistableBase'; the qualifier must be of type 'Seitz.iSeitz.Business.Objects.IseitzRoleCollection' (or derived from it) F:\MyWork\iseitzNHydrate\Seitz.iSeitz\Business\Objects\IseitzRoleCollection.Generated.cs 633 48 Seitz.iSeitz

there 256 errors with the same error description in each tables i think.

Error 24 Cannot access protected member 'Widgetsphere.Core.DataAccess.BusinessCollectionPersistableBase.GetCommand<TEntity>(System.Data.Linq.DataContext, System.Data.Linq.Table<TEntity>, System.Linq.Expressions.Expression<System.Func<TEntity,bool>>)' via a qualifier of type 'Widgetsphere.Core.DataAccess.BusinessCollectionPersistableBase'; the qualifier must be of type 'Seitz.iSeitz.Business.Objects.IseitzRoleCollection' (or derived from it) F:\MyWork\iseitzNHydrate\Seitz.iSeitz\Business\Objects\IseitzRoleCollection.Generated.cs 633 48 Seitz.iSeitz 

 

Coordinator
Oct 27, 2009 at 11:40 PM

please copy the widgetsphere.core.dll from program files/widgetsphere/codetools to your solutions bin folder. your existing version is old.

Oct 28, 2009 at 12:00 AM

dal error is fix thanks.

Heres my new error again :( when i try to run the install project

 Message="An expression of non-boolean type specified in a context where a condition is expected, near 'rc'."

here's the details

System.Data.SqlClient.SqlException was unhandled by user code

  Message="An expression of non-boolean type specified in a context where a condition is expected, near 'rc'."

  Source=".Net SqlClient Data Provider"

  ErrorCode=-2146232060

  Class=15

  LineNumber=10

  Number=4145

  Procedure=""

  Server="(local)\\MSSQLSERVER2008E"

  State=1

  StackTrace:

       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

       at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)

       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)

       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

       at Seitz.iSeitz.Install.SqlServers.ExecuteSQL(SqlConnection connection, SqlTransaction transaction, String sql) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\SqlServers.cs:line 887

       at Seitz.iSeitz.Install.SqlServers.RunEmbeddedFile(SqlConnection connection, SqlTransaction transaction, String resourceFileName) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\SqlServers.cs:line 857

       at Seitz.iSeitz.Install.UpgradeInstaller.UpgradeSchemaAndStaticData() in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\UpgradeInstaller.cs:line 163

       at Seitz.iSeitz.Install.UpgradeInstaller.RunUpgrade() in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\UpgradeInstaller.cs:line 86

       at Seitz.iSeitz.Install.UpgradeInstaller.UpgradeDatabase(String connectionString, Boolean newInstall) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\UpgradeInstaller.cs:line 36

       at Seitz.iSeitz.Install.DatabaseInstaller.Install(IDictionary stateSaver) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\DatabaseInstaller.cs:line 61

       at System.Configuration.Install.Installer.Install(IDictionary stateSaver)

       at System.Configuration.Install.AssemblyInstaller.Install(IDictionary savedState)

       at System.Configuration.Install.Installer.Install(IDictionary stateSaver)

       at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)

  InnerException: 

 

System.Data.SqlClient.SqlException was unhandled by user code
  Message="An expression of non-boolean type specified in a context where a condition is expected, near 'rc'."
  Source=".Net SqlClient Data Provider"
  ErrorCode=-2146232060
  Class=15
  LineNumber=10
  Number=4145
  Procedure=""
  Server="(local)\\MSSQLSERVER2008E"
  State=1
  StackTrace:
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at Seitz.iSeitz.Install.SqlServers.ExecuteSQL(SqlConnection connection, SqlTransaction transaction, String sql) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\SqlServers.cs:line 887
       at Seitz.iSeitz.Install.SqlServers.RunEmbeddedFile(SqlConnection connection, SqlTransaction transaction, String resourceFileName) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\SqlServers.cs:line 857
       at Seitz.iSeitz.Install.UpgradeInstaller.UpgradeSchemaAndStaticData() in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\UpgradeInstaller.cs:line 163
       at Seitz.iSeitz.Install.UpgradeInstaller.RunUpgrade() in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\UpgradeInstaller.cs:line 86
       at Seitz.iSeitz.Install.UpgradeInstaller.UpgradeDatabase(String connectionString, Boolean newInstall) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\UpgradeInstaller.cs:line 36
       at Seitz.iSeitz.Install.DatabaseInstaller.Install(IDictionary stateSaver) in F:\MyWork\iseitzNHydrate\Seitz.iSeitz.Install\DatabaseInstaller.cs:line 61
       at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
       at System.Configuration.Install.AssemblyInstaller.Install(IDictionary savedState)
       at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
       at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
  InnerException: 

 

 

Coordinator
Oct 28, 2009 at 12:32 AM

Please send your project (and model file) to me at chrisd@nhydrate.org. Please identify where the error is happening.

Coordinator
Oct 28, 2009 at 1:10 AM

I really need the SQL that is executing. Your project and model would be most helpful. Until I can see the SQL being executed I cannot proceed.

Oct 28, 2009 at 2:16 AM

file already sent to ur emal.

Coordinator
Oct 28, 2009 at 9:44 PM

This discussion was solved in another discussion.

REPOST:
After looking at your project, I have determined that this is due to a custom script that you have added. I see that it is similar to a script we included in the Northwind sample project. However there are some strange characters in it: underscores. It almost looks like you ued VB.NET to format the SQL. In any case, this is not generated code. You need to modify this custom code or remove it. The stack trace tell you how to find the bad SQL in case this happens again to you. You can step through the installer project that is executing the SQL and find the exact SQL that has an error.

Look for the SQL that starts like this "--DROP ALL INDEXES". This whole section is wrong, please remove it from your code or copy the correct code from the Northwind example.