Skip to main content

Posts

Showing posts with the label LINQ

LINQ

The three main data providers provided by Microsoft are: LINQ to objects for querying in-memory collections LINQ to SQL for querying relational databases LINQ to XML for querying XML data

Login Form Using LINQ in Windows Forms Application

Step 1:  First we create a database and then Table in SQL Server. Here we create a table named “logintb”. Now insert a name and Password into the logintb table. Step 2:  Open Visual Studio then select "File" -> "New" -> "Project..." then select "Windows Forms". Drag and drop a Label for ID and a Label for password. Drag and drop a TextBox for txtuser and a TextBox for txtPassword. Drag and drop a Button for Login. Step 3:  Go to the project then right-click and seelct "Add" -> "New Item..." then select "Windows Form" -> "LINQ to SQL Classes" then click on "Add". Now go to the Server Explorer, drag and drop the logintb table as in the following: Open Server Explorer and select the database and then the table. Step 4 :  Now double-click on the button Login in the form and write the following code: CS Code:   using  System; using  System.Collections.Generic; using  System.Comp...

LINQ Basic Quires

In this Article we learn Basic LINQ Queries in Asp.Net . 1-       Fill Gridview record: public void showgridview()     {         DataClassesDataContext dc = new DataClassesDataContext ();         var q =         from a in dc.GetTable< bio >()         select a;         GridView1.DataSource = q;         GridView1.DataBind();        }                             2-       Search record: public void SearchQuery()     {         DataClassesDataContext dc = new DataClassesDataContext ();      ...