hi i have tried to insert the data to data base, make use of class files.. I have two classes, from that one is Material.cs, and DataAccessLayer.cs. But executing my code i got error like Procedure or function sp_insert_componet has too many arguments specified.""
//From Material.cs
private string strCREATEDBY;
private string strCREATEDDATE;
private string strUPDATEDBY;
private string strUPDATEDDATE;
private string strSTATUS;
public string Createdby
{
get
{
return strCREATEDBY;
}
set
{
strCREATEDBY = value;
}
}
public string Createddate
{
get
{
return strCREATEDDATE;
}
set
{
strCREATEDDATE = value;
}
}
public string Updateddate
{
get
{
return strUPDATEDDATE;
}
set
{
strUPDATEDDATE = value;
}
}
public string Updatedby
{
get
{
return strUPDATEDBY;
}
set
{
strUPDATEDBY = value;
}
}
public string Status
{
get
{
return strSTATUS;
}
set
{
strSTATUS = value;
}
}
//Maingroup
//created by : ramya
//created date:15.2.2012
private string strIDENTIFY;
private string strNO;
private string strNAME;
private string strMAINIDENTIFICATION;
public string Identification
{
get
{
return strIDENTIFY;
}
set
{
strIDENTIFY = value;
}
}
public string NO
{
get
{
return strNO;
}
set
{
strNO = value;
}
}
public string NAME
{
get
{
return strNAME;
}
set
{
strNAME = value;
}
}
public string Mainidentify
{
get
{
return strMAINIDENTIFICATION;
}
set
{
strMAINIDENTIFICATION = value;
}
}
private string strItemtype;
public string Itemtype
{
get
{
return strItemtype;
}
set
{
strItemtype = value;
}
}
private string strSitename;
public string Sitename
{
get
{
return strSitename;
}
set
{
strSitename = value;
}
}
public int Savecomponent()
{
objDL.Addparam("@Createdby", Createdby);
objDL.Addparam("@Createddate", Createddate);
objDL.Addparam("@Sitecode", NO);
objDL.Addparam("@Itemtype", Itemtype);
objDL.Addparam("@Status", Status);
objDL.Addparam("@Maingroupsno", Mainidentify);
objDL.Addparam("@Subgroupsno", Identification);
objDL.Addparam("@Componetcode",NAME);
objDL.Addparam("@Sitename", Sitename);
int save = objDL.insert("sp_insert_componet");
if (save > 0)
{
return 1;
}
else
{
return 0;
}
}
//From DataAccessLayer.cs
public int insert(string strInsert)
{
try
{
Con.Open();
cmd.Connection = Con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = strInsert;
int RetInsert = cmd.ExecuteNonQuery();
return RetInsert;
}
catch (Exception ex)
{
throw ex;
}
//got error in this finally block
finally
{
Con.Close();
}
}
Solution. So to fix the error “You've entered too many arguments for this function” you need to go through the content of the cell, character-by-character, to ensure that there are no syntax errors. In other words, you need to check whether all opened brackets are closed and all commas are properly in place.
A procedure can have a maximum of 2100 parameters; each assigned a name, data type, and direction. Optionally, parameters can be assigned default values.
Setting up multiple parameters is very easy to do. You just need to list each parameter and the data type separated by a comma as shown below.
You are specifying arguments that the stored procedure isn't expecting. Remove any arguments that aren't defined by the stored procedure
Make sure that every parameter in the block
objDL.Addparam("@Createdby", Createdby);
objDL.Addparam("@Createddate", Createddate);
objDL.Addparam("@Sitecode", NO);
objDL.Addparam("@Itemtype", Itemtype);
objDL.Addparam("@Status", Status);
objDL.Addparam("@Maingroupsno", Mainidentify);
objDL.Addparam("@Subgroupsno", Identification);
objDL.Addparam("@Componetcode",NAME);
objDL.Addparam("@Sitename", Sitename);
has a corresponding parameter in the stored procedure. Remove any parameter that isn't defined in the procedure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With