Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 August 17th, 2005, 01:57 AM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prroblem with Parameters.

int xyz;
            cmd.CommandType =CommandType.StoredProcedure ;
            cmd.CommandText ="usercheck";
            SqlParameter p1=new SqlParameter ("@uname",System.Data .SqlDbType .VarChar ,2);
            p1.Direction =ParameterDirection.Input ;


            SqlParameter p2=new SqlParameter ("@pasword",System.Data .SqlDbType .VarChar ,2);
            p2.Direction =ParameterDirection.Input ;


            SqlParameter p3=new SqlParameter ("@res",System.Data .SqlDbType .Int ,4);
            p2.Direction =ParameterDirection.Output ;

            cmd.Parameters .Add(p1);
            cmd.Parameters .Add (p2);
            cmd.Parameters .Add (p3);

            xyz=cmd.ExecuteNonQuery ();
            if (xyz>0)
                Server.Transfer ("Form1.aspx");
            else
                Server.Transfer ("loginpage.aspx");

i got this error whuy pls

Procedure 'usercheck' expects parameter '@uname', which was not supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Procedure 'usercheck' expects parameter '@uname', which was not supplied.

Source Error:


Line 80: cmd.Parameters .Add (p3);
Line 81:
Line 82: xyz=cmd.ExecuteNonQuery ();
Line 83: if (xyz>0)
Line 84: Server.Transfer ("Form1.aspx");


Source File: c:\inetpub\wwwroot\passingvaluesforms\loginpage.as px.cs Line: 82



 
Old August 19th, 2005, 04:10 AM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi finally resolved that..

i forgot that assign values to the Parameter ..like..
p1.value=t1.text.

that it the problem was fixed..
thanks.
rams123






Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameters dcct84 C# 6 September 27th, 2007 05:26 PM
parameters dpkbahuguna ASP.NET 1.x and 2.0 Application Design 0 April 3rd, 2007 07:27 AM
Parameters Dharam80 Access 3 August 19th, 2005 01:59 PM





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