I am using below menioned code for Inserting Data into SQL and for that I have used below menioned code
public void ExecuteSQLCommandWithParameters(string command,params object[] Values)
{
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
conn.ConnectionString = _connectionString;
try
{
conn.Open();
System.Data.SqlClient.SqlCommand com = new System.Data.SqlClient.SqlCommand(command, conn);
for (int i = 0; i < Values.Length; i++)
{
com.Parameters.Add("@"+i.ToString(), Values[i]);
}
com.ExecuteNonQuery();
com.Dispose();
conn.Close();
Values = null;
}
catch (Exception ex)
{
log.Error(string.Format("Error in ExecuteSQLCommand(), command {0}, exception: {1}", command, ex.Message));
}
}
The above mentioned function will Execute A Thousand Times my question is is it required to make NULL params object[] Values
I means Do I need to write code like
Values=null;
Please suggest me