Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 16th, 2006, 07:13 AM
Registered User
 
Join Date: May 2006
Location: Tehran, Tehran, Iran.
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;
SqlConn.Open();
command.ExecuteNonQuery();
SqlConn.close()
but I get <Must declare the scalar variable "@Mysign"> error,what is my mistake?
Please help me.
yours sincerely.
Orchid


  #2 (permalink)  
Old September 22nd, 2006, 10:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Banbury, , United Kingdom.
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

Hi,

Try using

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

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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.