Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Using a Views in .net and c#

using (SqlConnection connection = new SqlConnection("Data Source=ravensqlexpress;Initial Catalog=ucs;Integrated Security=True;Pooling=False"))
{
    using (SqlCommand command = connection.CreateCommand())
    {
        command.CommandText = "SELECT * from your_view WHERE your_where_clause";

        connection.Open();
        using (SqlDataReader reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                // process result
                reader.GetInt32(0); // get first column from view, assume it's a 32-bit int
                reader.GetString(1); // get second column from view, assume it's a string
                // etc.
            }
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: htmlgenericcontrol class c# 
Csharp :: string in char list f# 
Csharp :: ASP.MVC display image from SqlServer 
Csharp :: unity shader blend 
Csharp :: index was out of the bound array in c# 
Csharp :: calculated field gridview asp.net 
Csharp :: class combining 
Csharp :: .net core not returning the sub list 
Csharp :: asp.net stop page jumping to top on click 
Csharp :: c# open explorer and select file 
Csharp :: linq contains null 
Csharp :: how to twist a image in the code behind C# 
Csharp :: c# stringwriter encoding iso-8859-1 example 
Csharp :: IOS app crashing on ios 15 unity 
Csharp :: temp^late php table for mysql 
Csharp :: mock return exception c# 
Csharp :: c# class where T : enum C# 7.03 
Csharp :: How to convert output of HttpClient PostAsJsonAsync() into user defined list of object 
Csharp :: c# summary angle brackets 
Csharp :: How to put a (new line) inside a list box 
Csharp :: soundplayer c# take uri 
Csharp :: unity organize variables in inspector 
Csharp :: .net return context.Result without extra new objectResult 
Csharp :: create entity c# d365 
Csharp :: how to full screen login form using C# MVC 
Csharp :: qcombobox delegate text filter 
Csharp :: c# use list as a paramter 
Csharp :: UnitType parameter revit 2022 
Csharp :: Avoid auto-filling persian time picker 
Csharp :: tuples in c# 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =