Wrox Programmer Forums
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 16th, 2006, 07:13 AM
Registered User
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default "Must declare the scalar variable"

Hi every one ,
I'm programming with C# and I wrote below code :
command = new System.Data.Odbc.OdbcCommand();
command.CommandType = System.Data.CommandType.Text;
commString = "INSERT INTO MyTable (MySign) VALUES (@MySign)";
command.CommandText = commString;
command.Connection = SqlConn; //is defined
command.Parameters.Add("@MySign", OdbcType.VarBinary).Value = MySign;
but I get <Must declare the scalar variable "@Mysign"> error,what is my mistake?
Please help me.
yours sincerely.

Old September 22nd, 2006, 10:56 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM


Try using

OdbcParameter param = new OdbcParameter("@MySign", OdbcType.VarBinary);
param.Value = MySign

instead of the line

command.Parameters.Add("@MySign", OdbcType.VarBinary).Value = some variable;

and make sure that the variable you are setting the variable to has already been defined and has a value.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Must declare the scalar variable stapes ASP.NET 2.0 Basics 1 August 15th, 2008 10:03 AM
Must declare the scalar variable "@x_id". neeleen Visual Basic 2005 Basics 0 December 14th, 2007 06:07 AM
DataGridView Error Must declare the scalar var. program2be BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 February 11th, 2007 04:39 PM
DataGridView Error Must Declare Scalar Var. program2be Visual Basic 2005 Basics 1 January 29th, 2007 11:08 PM
Must declare the scalar variable kofibull Visual Studio 2005 0 November 24th, 2006 05:47 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.