程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> 本身編寫sqlhelper類示例分享

本身編寫sqlhelper類示例分享

編輯:C#入門知識

本身編寫sqlhelper類示例分享。本站提示廣大學習愛好者:(本身編寫sqlhelper類示例分享)文章只能為提供參考,不一定能成為您想要的結果。以下是本身編寫sqlhelper類示例分享正文


本身編寫SqlHelper,年夜家參考應用吧


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data; using System.Data.SqlClient;

namespace SqlHelper
{
    /// <summary>
    /// Window1.xaml 的交互邏輯
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        //只用來履行查詢成果比擬少的sql
        private void btnds_Click(object sender, RoutedEventArgs e)
        {
            SqlHelper.ExecuteNonQurey("insert into T_Student(Name,Age) values('張三',55)",
                new SqlParameter[0]);
            MessageBox.Show("添加勝利");
        }

        private void btnDataSet_Click(object sender, RoutedEventArgs e)
        {
            DataSet ds= SqlHelper.ExecuteDataSet("select * from T_Student where hobbit='@hobbit'",
                new SqlParameter[]{new SqlParameter("'@hobbit'","哈哈哈")});
            foreach(DataRow row in ds.Tables[0].Rows)
            {
                string name = (string)row["Name"];
                MessageBox.Show(name);
            }
        }
    }
}
; System.out.println( ch.i3 );//i3可以在B中拜訪 System.out.println( ch.i4 ); */ /*5 Chengyuan ch = new Chengyuan();//其余包其余類有繼續關系Chengyuan extends D System.out.println( ch.i1 ); System.out.println( ch.i2 );//i2在D中不是公共的;沒法從內部法式包中對其停止拜訪 System.out.println( ch.i3 );//i3可以在D中拜訪private System.out.println( ch.i4 ); */ //====================================================== //二 成員辦法的拜訪權限 /*1 Chengyuan ch = new Chengyuan();//本身包本身類 System.out.println( ch.m1() ); System.out.println( ch.m2() ); System.out.println( ch.m3() ); System.out.println( ch.m4() ); */ /*2 B b = new B();//本身包其余類 System.out.println( b.m1() ); System.out.println( b.m2() ); System.out.println( b.m3() );//m3()可以在B中拜訪private System.out.println( b.m4() ); */ /*3 E e = new E();//其余包 其余類 System.out.println( e.m1() ); System.out.println( e.m2() );//m2在E中不是公共的;沒法從內部法式包中對其停止拜訪 System.out.println( e.m3() );//m3可以在E中拜訪private System.out.println( e.m4() ); //m4()可以在E中拜訪protected */ /*4 C c = new C();//本身包其余類有繼續關系Chengyuan extends C System.out.println( c.m1() ); System.out.println( c.m2() ); System.out.println( c.m3() );//m3()可以在C中拜訪 System.out.println( c.m4() ); */ //5 Chengyuan ch = new Chengyuan(); System.out.println( ch.m1() ); System.out.println( ch.m2() );//找不到符號 System.out.println( ch.m3() );//找不到符號 System.out.println( ch.m4() ); } } class B{ //1 成員變量 public int i1 = 100; int i2 = 200; private int i3 = 300; protected int i4 = 400; //2 成員辦法 public int m1(){return 1;} int m2(){return 1;} private int m3(){return 1;} protected int m4(){return 1;} } class C{ //1 成員變量 public int i1 = 100; int i2 = 200; private int i3 = 300; protected int i4 = 400; //2 成員辦法 public int m1(){return 1;} int m2(){return 1;} private int m3(){return 1;} protected int m4(){return 1;} } //======================================================== //D.class文件和E.class文件在cn包內,為了便利把他們放到這裡 package cn.jaovo; public class D{ //1 成員變量 public int i1 = 100; int i2 = 200; private int i3 = 300; protected int i4 = 400; //2 成員辦法 public int m1(){return 1;} int m2(){return 1;} private int m3(){return 1;} protected int m4(){return 1;} } //------- package cn.jaovo; public class E{ //1 成員變量 public int i1 = 100; int i2 = 200; private int i3 = 300; protected int i4 = 400; //2 成員辦法 public int m1(){return 1;} int m2(){return 1;} private int m3(){return 1;} protected int m4(){return 1;} }

以上代碼是Java中成員辦法與成員變量拜訪權限詳解,願望年夜家愛好。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved