Not able to refresh Sql Tab

8 views
Skip to first unread message

penujuru kavya

unread,
Sep 28, 2015, 10:39:06 AM9/28/15
to GetGlimpse-dev
Hi,

I have used my helper class as below:

public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
        {
            DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient"); 
            using (var connection = factory.CreateConnection())
            {
                using (DbCommand command = factory.CreateCommand())
                {
                    connection.ConnectionString = connectionString;
                    command.Connection = connection;
                    command.CommandType = commandType;
                    command.CommandText = commandText;
                    command.Parameters.AddRange(commandParameters);
                    connection.Open();
                    DataSet ds = new DataSet();
                    DataTable table = new DataTable();
                    table.Load(command.ExecuteReader());
                    ds.Tables.Add(table);
                    connection.Close();
                    return ds;
                }
            }
        }

But it is working only once. When I run my code, Sql tab shows only information run through it for the first time, that is only one SP is shown all the time.
And if I perform some other action also like going to new tab in my web page again it shows the same SP information.
Am I missing anything here.

Thanks,
Kavya
Reply all
Reply to author
Forward
0 new messages