本文介绍了过程或函数AddTempMember指定的参数过多.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 strQuery = " " ;
            strQuery = " 选择*从FirstName ='"  + txtFirstName.Text.Trim()的成员中" '和LastName ='"  + txtLastName.Text.Trim()+ "  '和FathersName ='" + txtFathersName.Text.Trim()+ "  '";
            DataTable dtabCheckExistence =  DataTable();
            dtabCheckExistence = AC.GetValuesInDataTable(strQuery);
            如果(dtabCheckExistence.Rows.Count <   3  || dtabCheckExistence.Rows.Count ==  0 )
            {
                con =  SqlConnection(ConfigurationManager.ConnectionStrings ["  amms" ].ConnectionString);
                cmd =  SqlCommand();
                con.Open();
                cmd.Connection = con;

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "  AddTempMember" ;
                cmd.Parameters.AddWithValue("  @ ParentId" ,txtPlaceUnderID.Text.Trim());
                cmd.Parameters.AddWithValue("  @ ThroughOverId" ,(txtSponsorID.Text.Trim()== " " ?:txtSponsorID.Text.修剪()));
                cmd.Parameters.AddWithValue("  @ Leg" ,rdolstNode.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("  @ Title" ,ddlTitle.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("  @ FirstName" ,txtFirstName.Text.Trim());
                cmd.Parameters.AddWithValue("  @ LastName" ,txtLastName.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Type" ,ddlFathersHusband.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("  @ FathersName" ,txtFathersName.Text.Trim());
                cmd.Parameters.AddWithValue("  @ MothersName" );
                cmd.Parameters.AddWithValue("  @ MaritalStatus" ,ddlMaritalStatus.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Address" ,txtAddress.Text.Trim());
                cmd.Parameters.AddWithValue("  @ City" ,txtCity.Text.Trim());
                cmd.Parameters.AddWithValue("  @ State" ,ddlState.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Country" ,txtCountry.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Pin" ,txtPinCode.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Std" ,txtStdCode.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Phone" ,txtPhone.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Mobile" ,txtMobile.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Email" ,txtEmail.Text.Trim());
                cmd.Parameters.AddWithValue("  @ LoginId" );
                cmd.Parameters.AddWithValue("  @ Password"  null );
                cmd.Parameters.AddWithValue("  @ DOB" ,(txtDOB.Text.Trim()== " " ?:Convert.ToDateTime( txtDOB.Text.Trim()).ToString("  MM/dd/yyyy" )))));
                cmd.Parameters.AddWithValue("  @ Age" ,lblAge.Text.Trim());
                cmd.Parameters.AddWithValue("  @ Sex" ,ddlGender.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("  @ PAN" ,txtPanCardNo.Text.Trim());
                cmd.Parameters.AddWithValue("  @ PinNo" );
                cmd.Parameters.AddWithValue("  @ NomineeName" ,txtNomineeName.Text.Trim());
                cmd.Parameters.AddWithValue("  @ NomineeRelation" ,txtNomineeRelation.Text.Trim());
                cmd.Parameters.AddWithValue("  @ NomineeDOB" ,(txtNomineeDOB.Text.Trim()== " " ?:Convert.ToDateTime( txtNomineeDOB.Text.Trim()).ToString("  MM/dd/yyyy" ))));
                cmd.Parameters.AddWithValue("  @ ProductCode" ,ddlProduct.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("  @ PaymentOption" );
                cmd.Parameters.AddWithValue("  @ PaymentMode" ,ddlPaymentMode.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("  @ Amount" ,txtAmount.Text.Trim());
                cmd.Parameters.AddWithValue("  @ AmountBalance" ,txtBalanceAmount.Text.Trim());
                cmd.Parameters.AddWithValue("  @ BankName" ,txtBankName.Text.Trim());
                cmd.Parameters.AddWithValue("  @ DDChequeNo" ,txtChequeDDNo.Text.Trim());
                cmd.Parameters.AddWithValue("  @ DDChequeDate" ,(txtChequeDDDate.Text.Trim()== " " ?:Convert.ToDateTime( txtChequeDDDate.Text.Trim()).ToString("  MM/dd/yyyy" ))));
                cmd.Parameters.AddWithValue("  @ Payable" ,txtPayble.Text.Trim());
                cmd.Parameters.AddWithValue("  @ MemberAccNo" ,txtCBSacNo.Text.Trim());
                cmd.Parameters.AddWithValue("  @ MemberBankName" ,txtMemberBankName.Text.Trim());
                cmd.Parameters.AddWithValue("  @ MemberBranch" ,txtBankBranch.Text.Trim());
                cmd.Parameters.AddWithValue("  @ DepotCode" ,(txtBranchCode.Text.Trim()== " " ?:txtBranchCode.Text.修剪()));
                cmd.Parameters.AddWithValue("  @ ReceiptNo" );
                cmd.Parameters.AddWithValue("  @ JoiningDate" ,(txtJoiningDate.Text.Trim()== " " ?:Convert.ToDateTime( txtJoiningDate.Text.Trim()).ToString("  MM/dd/yyyy" ))));
               cmd.Parameters.AddWithValue("  @ CreatedBy" ,Convert.ToString(Session ["   UserId"])));
                cmd.Parameters.AddWithValue("  @ MemId"  0 ).Direction = ParameterDirection.InputOutput;
                cmd.Parameters.AddWithValue("  @ msg"  0 ).Direction = ParameterDirection.InputOutput;
                cmd.ExecuteNonQuery();
                con.Close(); 


程序是:

 创建 过程 [dbo].[AddTempMember]( @ ParentId   int  @ ThroughOverId   int  @ Leg   VARCHAR ( 50 ), @标题  varchar ( 50 ), @名字  varchar ( 50 ), @姓氏  varchar ( 50 ), @ Type   varchar ( 50 ), @ FathersName   varchar ( 50 ), @ MothersName   varchar ( 50 ), @ MaritalStatus   varchar  ( 50 ), @ Address   varchar (  50 ), @城市  varchar ( 50 ), @ State   varchar ( 50 ), @ Country   varchar ( 50 ), @ Pin   varchar ( 50 ), @ Std   varchar ( 50 ), @ Phone   varchar ( 50 ), @ Mobile   varchar ( 50 ), @电子邮件  varchar ( 50 ), @ LoginId   varchar ( 50 ), @密码  varchar ( 50 ), @ DOB  日期 @ Age   VARCHAR ( 50 ), @性别  varchar ( 50 ), @PAN   varchar ( 50 ), @NomineeName   varchar ( 50 ), @NomineeRelation   varchar ( 50 ), @ NomineeDOB   varchar ( 50 ), @ ProductCode   varchar ( 50 ), @ PaymentOption   varchar ( 50 ), @ PaymentMode   varchar ( 50 ), @金额 金钱 @ AmountBalance  金钱 @ BankName   varchar ( 50 ), @ DDChequeNo   varchar ( 50 ), @ DDChequeDate  日期, @ Payable   varchar ( 50 ), @ MemberAccNo   varchar ( 50 ), @ MemberBankName   varchar ( 50 ), @ MemberBranch   varchar ( 50 ), @ DepotCode   varchar ( 50 ), @ ReceiptNo   varchar ( 50 ), @ JoiningDate   varchar ( 50 ), @ CreatedBy   varchar ( 50 ), @ MemId   int  @msg   varchar ( 50 ))

 AS   BEGIN 
插入  INTO 成员(ParentId,ThroughOverId,Leg,Title,FirstName,LastName,类型,父亲姓名,母亲姓名,婚姻状况,地址,城市,州,国家/地区,Pin,Std,电话,手机,电子邮件,LoginId,密码,DOB,年龄,性别,PAN,被提名人姓名,被提名人关系,提名人DOB,ProductCode,PaymentOption,PaymentMode,Amount,AmountBalance,BankName,DDChequeNo,DDChequeDate,Payable,MemberAccNo,MemberBankName,MemberBranch,DepotCode,ReceiptNo,JoiningDate,CreatedBy,MemId,msg)
( @ ParentId  @ ThroughOverId  @腿 @标题 @名字 @姓氏 @ Type  @ FathersName  @ MothersName  @ MaritalStatus  @ Address , @城市 @ State  @ Country  @ Pin  @ Std  @ Phone  @ Mobile  @电子邮件 @ LoginId  @ Password  @ DOB  @ Age  @@性别 @ PAN  @ NomineeName  @NomineeRelation  @ NomineeDOB  @ ProductCode  @PaymentOption  @ PaymentMode  @ Amount  @AmountBalance  @ BankName  @ DDChequeNo  @ DDChequeDate  @ Payable  @ MemberAccNo  @ MemberBankName  @ MemberBranch  @ DepotCode  @ ReceiptNo  @ JoiningDate  @ CreatedBy  @ MemId  @ msg )
 END  
解决方案


strQuery = "";
            strQuery = "Select * From Members Where FirstName = '" + txtFirstName.Text.Trim() + "' and LastName = '" + txtLastName.Text.Trim() + "' and FathersName ='" + txtFathersName.Text.Trim() + "' ";
            DataTable dtabCheckExistence = new DataTable();
            dtabCheckExistence = AC.GetValuesInDataTable(strQuery);
            if (dtabCheckExistence.Rows.Count < 3 || dtabCheckExistence.Rows.Count == 0)
            {
                con = new SqlConnection(ConfigurationManager.ConnectionStrings["amms"].ConnectionString);
                cmd = new SqlCommand();
                con.Open();
                cmd.Connection = con;

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "AddTempMember";
                cmd.Parameters.AddWithValue("@ParentId", txtPlaceUnderID.Text.Trim());
                cmd.Parameters.AddWithValue("@ThroughOverId", (txtSponsorID.Text.Trim() == "" ? null : txtSponsorID.Text.Trim()));
                cmd.Parameters.AddWithValue("@Leg", rdolstNode.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("@Title", ddlTitle.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("@FirstName", txtFirstName.Text.Trim());
                cmd.Parameters.AddWithValue("@LastName", txtLastName.Text.Trim());
                cmd.Parameters.AddWithValue("@Type", ddlFathersHusband.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("@FathersName", txtFathersName.Text.Trim());
                cmd.Parameters.AddWithValue("@MothersName", null);
                cmd.Parameters.AddWithValue("@MaritalStatus", ddlMaritalStatus.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("@Address", txtAddress.Text.Trim());
                cmd.Parameters.AddWithValue("@City", txtCity.Text.Trim());
                cmd.Parameters.AddWithValue("@State", ddlState.SelectedItem.Text.Trim());
                cmd.Parameters.AddWithValue("@Country", txtCountry.Text.Trim());
                cmd.Parameters.AddWithValue("@Pin", txtPinCode.Text.Trim());
                cmd.Parameters.AddWithValue("@Std", txtStdCode.Text.Trim());
                cmd.Parameters.AddWithValue("@Phone", txtPhone.Text.Trim());
                cmd.Parameters.AddWithValue("@Mobile", txtMobile.Text.Trim());
                cmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim());
                cmd.Parameters.AddWithValue("@LoginId", null);
                cmd.Parameters.AddWithValue("@Password", null);
                cmd.Parameters.AddWithValue("@DOB", (txtDOB.Text.Trim() == "" ? null : Convert.ToDateTime(txtDOB.Text.Trim()).ToString("MM/dd/yyyy")));
                cmd.Parameters.AddWithValue("@Age", lblAge.Text.Trim());
                cmd.Parameters.AddWithValue("@Sex", ddlGender.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("@PAN", txtPanCardNo.Text.Trim());
                cmd.Parameters.AddWithValue("@PinNo", null);
                cmd.Parameters.AddWithValue("@NomineeName", txtNomineeName.Text.Trim());
                cmd.Parameters.AddWithValue("@NomineeRelation", txtNomineeRelation.Text.Trim());
                cmd.Parameters.AddWithValue("@NomineeDOB", (txtNomineeDOB.Text.Trim() == "" ? null : Convert.ToDateTime(txtNomineeDOB.Text.Trim()).ToString("MM/dd/yyyy")));
                cmd.Parameters.AddWithValue("@ProductCode", ddlProduct.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("@PaymentOption", null);
                cmd.Parameters.AddWithValue("@PaymentMode", ddlPaymentMode.SelectedItem.Value.Trim());
                cmd.Parameters.AddWithValue("@Amount", txtAmount.Text.Trim());
                cmd.Parameters.AddWithValue("@AmountBalance", txtBalanceAmount.Text.Trim());
                cmd.Parameters.AddWithValue("@BankName", txtBankName.Text.Trim());
                cmd.Parameters.AddWithValue("@DDChequeNo", txtChequeDDNo.Text.Trim());
                cmd.Parameters.AddWithValue("@DDChequeDate", (txtChequeDDDate.Text.Trim() == "" ? null : Convert.ToDateTime(txtChequeDDDate.Text.Trim()).ToString("MM/dd/yyyy")));
                cmd.Parameters.AddWithValue("@Payable", txtPayble.Text.Trim());
                cmd.Parameters.AddWithValue("@MemberAccNo", txtCBSacNo.Text.Trim());
                cmd.Parameters.AddWithValue("@MemberBankName", txtMemberBankName.Text.Trim());
                cmd.Parameters.AddWithValue("@MemberBranch", txtBankBranch.Text.Trim());
                cmd.Parameters.AddWithValue("@DepotCode", (txtBranchCode.Text.Trim() == "" ? null : txtBranchCode.Text.Trim()));
                cmd.Parameters.AddWithValue("@ReceiptNo", null);
                cmd.Parameters.AddWithValue("@JoiningDate", (txtJoiningDate.Text.Trim() == "" ? null : Convert.ToDateTime(txtJoiningDate.Text.Trim()).ToString("MM/dd/yyyy")));
               cmd.Parameters.AddWithValue("@CreatedBy", Convert.ToString(Session["UserId"]));
                cmd.Parameters.AddWithValue("@MemId", 0).Direction = ParameterDirection.InputOutput;
                cmd.Parameters.AddWithValue("@msg", 0).Direction = ParameterDirection.InputOutput;
                cmd.ExecuteNonQuery();
                con.Close();


Procedure is :

CREATE PROCEDURE [dbo].[AddTempMember](@ParentId int,@ThroughOverId int, @Leg VARCHAR(50),@Title varchar(50),@FirstName varchar(50),@LastName varchar(50), @Type varchar(50),@FathersName varchar(50),@MothersName varchar(50), @MaritalStatus varchar(50), @Address varchar(50), @City varchar(50), @State varchar(50),@Country varchar(50),@Pin varchar(50),@Std varchar(50),@Phone varchar(50),@Mobile varchar(50),@Email varchar(50),@LoginId varchar(50),@Password varchar(50),@DOB date,@Age VARCHAR(50),@Sex varchar(50),@PAN varchar(50),@NomineeName varchar(50),@NomineeRelation varchar(50),@NomineeDOB varchar(50),@ProductCode varchar(50),@PaymentOption varchar(50),@PaymentMode varchar(50),@Amount money,@AmountBalance money,@BankName varchar(50),@DDChequeNo varchar(50),@DDChequeDate date,@Payable varchar(50),@MemberAccNo varchar(50),@MemberBankName varchar(50),@MemberBranch varchar(50),@DepotCode varchar(50),@ReceiptNo varchar(50),@JoiningDate varchar(50),@CreatedBy varchar(50),@MemId int,@msg varchar(50))

AS BEGIN
INSERT INTO Members(ParentId, ThroughOverId,Leg,Title,FirstName,LastName,Type,FathersName,MothersName,MaritalStatus,Address ,City,State,Country,Pin,Std,Phone,Mobile,Email,LoginId,Password,DOB,Age,Sex,PAN,NomineeName,NomineeRelation,NomineeDOB,ProductCode,PaymentOption,PaymentMode,Amount,AmountBalance,BankName,DDChequeNo,DDChequeDate,Payable,MemberAccNo,MemberBankName,MemberBranch,DepotCode,ReceiptNo,JoiningDate,CreatedBy,MemId,msg)
values (@ParentId,@ThroughOverId,@Leg,@Title,@FirstName,@LastName,@Type,@FathersName,@MothersName,@MaritalStatus,@Address ,@City,@State ,@Country,@Pin,@Std,@Phone,@Mobile,@Email,@LoginId,@Password,@DOB,@Age,@Sex,@PAN,@NomineeName,@NomineeRelation,@NomineeDOB,@ProductCode,@PaymentOption,@PaymentMode,@Amount,@AmountBalance,@BankName,@DDChequeNo,@DDChequeDate,@Payable,@MemberAccNo,@MemberBankName,@MemberBranch,@DepotCode,@ReceiptNo,@JoiningDate,@CreatedBy,@MemId,@msg)
END
解决方案


这篇关于过程或函数AddTempMember指定的参数过多.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 04:41