Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CmdLineKeyGenerator Error: Must declare the scalar variable

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support
View previous topic :: View next topic  
Author Message
anovak



Joined: 27 Nov 2012
Posts: 2

PostPosted: Tue Nov 27, 2012 12:17 am    Post subject: CmdLineKeyGenerator Error: Must declare the scalar variable Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Nov 27, 2012 9:58 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group