Is this a good approach to getting data from a stored procedure? For example, the procedure creates select * from base . Here is my code, but I need help with the dataset and adapter:
public static DataSet Osvezi(string naziv_tablice) { SqlCommand cmd = null; DataSet dataset = null; SqlConnection konekcija = new SqlConnection(ConfigurationManager.AppSettings["skripta"]); if (konekcija != null) { try { if (konekcija.State == ConnectionState.Closed) konekcija.Open(); cmd = new SqlCommand(); cmd.Connection = konekcija; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Osvezi"; cmd.Parameters.Add(new SqlParameter("@tablica", SqlDbType.Int)).Value = naziv_tablice; cmd.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(cmd); // Fill the DataSet using default values for DataTable names, etc da.Fill(dataset); return dataset; } catch (Exception ee) { //Obravnava napak } finally { konekcija.Close(); konekcija.Dispose(); cmd.Dispose(); } return dataset; } return dataset; }
user1116851
source share