is it possible to read the fields that have a view in SQL server from C # webform?

0

Is it possible to get the headings of a view on SQl server from a C # form, and send these names to a textbox separated by commas? for example:

What would you call this what I try to do to investigate?

camposSQL = LeerVista: "vw_VistaNombre"

this.textbox.text = camposSQL;

with the guide of @reekeecast I update the code I have (it still does not work, it only returns the first record):

string constr = ConfigurationManager.ConnectionStrings["MyConnString"].ConnectionString;
        SqlConnection viewViewer = new SqlConnection(constr);
        {
            SqlCommand cmd = new SqlCommand("SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = @viewName", viewViewer);

            cmd.Parameters.AddWithValue("@viewName", txtVista.Text); 
            viewViewer.Open();
            var resultadoColumnas = cmd.ExecuteScalar();
            lblamposVista.Text = Convert.ToString(resultadoColumnas);            
            viewViewer.Close();
        }
    
asked by Vulpex 01.11.2017 в 20:06
source

0 answers