Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello
I Want to Make a Common Method to Insert In Class That I Can Access on any form with any no of parameters using c#


Plzz Help me to do This
Thanks in Advance
Heera Midha
Posted
Comments
E.F. Nijboer 10-Sep-13 6:31am    
Very unclear, please explain some more. Do you just want to create an extension on Form with a method that uses params array to allow any number of parameters?

1 solution

public bool InsertUpdateDelete(string command)
{
try
{
connection.open();
sqlCommand cmd=new SqlCommand(command,connection);
int count=command.ExecuteNonQuerry();
if(count>0)
{
bool result=true;
}
else
{
result=false;
}
}
catch(Exception ex)
{
throw;
}
finally
{
connection.close();
}
}
//if it returns true operation is successful
else
failed
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900