Answers for "select linq c# example"

SQL
3

c# sql select

SqlConnection conn = new SqlConnection("Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=");
conn.Open();

SqlCommand command = new SqlCommand("Select id from [table1] where name=@zip", conn);
command.Parameters.AddWithValue("@zip","india");
 // int result = command.ExecuteNonQuery();
using (SqlDataReader reader = command.ExecuteReader())
{
  if (reader.Read())
  {
     Console.WriteLine(String.Format("{0}",reader["id"]));
   }
}

conn.Close();
Posted by: Guest on January-08-2021
1

linq query select where c#

var queryLondonCustomers = from cust in customers
                           where cust.City == "London"
                           select cust;
Posted by: Guest on November-05-2020
1

linq select

IEnumerable<SelectListItem> stores =
        from store in database.Stores
        where store.CompanyID == curCompany.ID
        select new SelectListItem { Value = store.Name, Text = store.ID };
Posted by: Guest on July-11-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language