Restaurant Item Enquiry

Source: Internet
Author: User

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Threading.Tasks;9 usingSystem.Windows.Forms;Ten usingSystem.Data.SqlClient; One  A namespaceRestaurant - { -      Public Partial classForm1:form the     { -  -  -  +          PublicForm1 () -         { + InitializeComponent (); A         } at  -         Private voidForm1_Load (Objectsender, EventArgs e) -         { -Loaddeskinfobydelflag (0); -  -         } in  -         Private voidLoaddeskinfobydelflag (intp) to         { +             //New Collection -list<deskinfo> list =NewList<deskinfo>(); the             //Database String *             stringstr ="Data Source=.;i Nitial catalog=mysql;integrated security=true"; $             //SQL statement, table with flag 0Panax Notoginseng             stringsql ="Select Deskid,deskname,desknamepinyin,desknum from deskinfo where Deskdelflag ="+p; -             //String sql = "SELECT * from Deskinfo"; theSqlConnection con =NewSqlConnection (str); + con. Open (); ASqlCommand cmd =NewSqlCommand (sql, con); the             //cmd.reader for Query +SqlDataReader reader =cmd. ExecuteReader (); -             //determine if a line is read $             if(reader. HasRows) $             { -                 //when I read it, -                  while(reader. Read ()) the                 { -                     //instantiate a table class, assign a value to each property, value as a value in the database, make a type conversionWuyiDeskinfo DK =Newdeskinfo (); theDk. Deskid = Convert.ToInt32 (reader["Deskid"]); -Dk. Deskname = reader["Deskname"]. ToString (); WuDk. Desknamepinyin = reader["Desknamepinyin"]. ToString (); -Dk. Desknum = reader["Desknum"]. ToString (); About                     //Add attributes to list $ list. ADD (DK); -                 } -  -             } A             //Disable automatic column generation, no delflag column.  +DGV. AutoGenerateColumns =false; the             //binding Data -DGV. DataSource =list; $  the             //Close Database Items the con. Dispose (); the cmd. Dispose (); the Reader. Dispose (); -         } in     } the}

Restaurant Item Enquiry

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.