Report Data Source - Change Table Name at runtime

Hi There,

I am new to Combit List n Label and busy doing a POC project with this product.

So I have an ASP.NET MVC Web application that will preview a report. So a user will process a report and at runtime, I need to update the report data source.

So basically the report was designed with the following table name in SQL 56ce85c5-f082-483e-ab4b-38e6edc9010e_BinItem. When the report is processed by a user I need to update the report data source to point to this table 4b0135d3-3d59-40be-aa7a-83992a094cb3_BinItem.

My application is developed in C#

Here is a sample of what my code looks like

string SelectStatement = “SELECT * FROM [DS006_CMP_EDU1_800_SRS].[dbo].[4b0135d3-3d59-40be-aa7a-83992a094cb3_BinItem]”;

        using (SqlConnection sqlConnection = new SqlConnection(ConnectionString))
        {
            sqlConnection.Open();

            using (SqlCommand sqlCommand = new SqlCommand(SelectStatement, sqlConnection))
            {
                using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand))
                {
                    DataSet dataSet = new DataSet();
                    sqlDataAdapter.Fill(dataSet, "BinItem");
                    return dataSet;
                }

Thanks in advance

List & Label won’t care about the physical table name, as long as the schema stays the same. If you’re working with an intermediate DataSet as shown in your code, you will be just fine with changing the SQL table, as the DataSet table name will stay the same.

Thank you so much, that works. I just got make sure I maintain the table name as well.

1 Like

© combit GmbH