View previous topic :: View next topic |
Author |
Message |
anovak
Joined: 27 Nov 2012 Posts: 2
|
Posted: Tue Nov 27, 2012 12:17 am Post subject: CmdLineKeyGenerator Error: Must declare the scalar variable |
|
|
Hi Support
I am currently integrating ILS into our existing PP IPN infrastructure and essentially copied the code out of the CmdLineKeyGenerator into our website code. The ILS database is stored on a SqlServer 2008 using integrated authentication. I see an exception each time on the call to:
Product product = database.GetProductByName()
Which throws the following exception:
{"Must declare the scalar variable \"@pValue\"."}
at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr)
at System.Data.OleDb.OleDbDataReader.NextResult()
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at Infralution.Licensing.Data.Database.GetReader(String table, String field, Object value)
at Infralution.Licensing.Data.Database.GetProductByName(String productName)
at CmdLineKeyGenerator.Program.Main(String[] args) in C:\Program Files\Infralution\Licensing System 5\Samples\VS2010\C#\CmdLineKeyGenerator\Program.cs:line 103
As you can probably see, I have been able to reproduce this problem using the CmdLineKeyGenerator sample code and changing the connection string to the following:
return @"Provider=SQLOLEDB.1;Data Source=localhost;Initial Catalog=ILSLicenseTracker;Integrated Security=SSPI";
After a google, I can across this article and wonder if I am seeing this behaviour (item 2)
http://blogs.msdn.com/b/spike/archive/2010/03/03/must-declare-the-scalar-variable.aspx
If you could suggest a resolution or believe that my connection string is somehow invalid, some advice would be appreciated.
Regards
A Novak |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Nov 27, 2012 9:58 am Post subject: |
|
|
The connection string for SQL Server should not include the Provider parameter ie it should be:
Code: | return @"Data Source=localhost;Initial Catalog=ILSLicenseTracker;Integrated Security=True"; |
And you also need to set the isSQLServer parameter to true in the Database constructor ie:
Code: | using (Database database = new Database(connectionString, true)) |
_________________ Infralution Support |
|
Back to top |
|
|
|