प्रशिक्षण
मॉड्यूल
Write your first query with Kusto Query Language - Training
Learn how to write simple queries in Kusto Query Language (KQL) by using the operators take, project, count, where, and sort.
यह ब्राउज़र अब समर्थित नहीं है.
नवीनतम सुविधाओं, सुरक्षा अपडेट और तकनीकी सहायता का लाभ लेने के लिए Microsoft Edge में अपग्रेड करें.
The examples in this topic demonstrate how to use the First method to query the AdventureWorks Sales Model using the query expression syntax. The AdventureWorks Sales Model used in these examples is built from the Contact, Address, Product, SalesOrderHeader, and SalesOrderDetail tables in the AdventureWorks sample database.
The examples in this topic use the following using
/Imports
statements:
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;
using System.Globalization;
using System.Data.EntityClient;
using System.Data.SqlClient;
using System.Data.Common;
Option Explicit On
Option Strict On
Imports System.Data.Objects
Imports System.Globalization
The following example uses the First method to return the first contact whose first name is "Brooke".
string firstName = "Brooke";
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
ObjectSet<Contact> contacts = context.Contacts;
Contact query = (
from contact in contacts
where contact.FirstName == firstName
select contact)
.First();
Console.WriteLine("ContactID: " + query.ContactID);
Console.WriteLine("FirstName: " + query.FirstName);
Console.WriteLine("LastName: " + query.LastName);
}
Dim firstName = "Brooke"
Using context As New AdventureWorksEntities
Dim contacts As ObjectSet(Of Contact) = context.Contacts
Dim query As Contact = ( _
From cont In contacts _
Where cont.FirstName = firstName _
Select cont).First()
Console.WriteLine("ContactID: " & query.ContactID)
Console.WriteLine("FirstName: " & query.FirstName)
Console.WriteLine("LastName: " & query.LastName)
End Using
प्रशिक्षण
मॉड्यूल
Write your first query with Kusto Query Language - Training
Learn how to write simple queries in Kusto Query Language (KQL) by using the operators take, project, count, where, and sort.