public DataTable ExecuteRreader(string sp_name, Dictionary<string, object> parameters) { using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { SqlCommand sqlCommand = new SqlCommand(sp_name, sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; if (parameters != null) { foreach (KeyValuePair<string, object> parameter in parameters) sqlCommand.Parameters.AddWithValue(parameter.Key, parameter.Value); } DataTable dataTable = new DataTable(); sqlConnection.Open(); using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader()) { dataTable.Load(sqlDataReader); } return dataTable; } }
Tuesday, October 15, 2013
sql reader
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment