C# SQL封裝(二)

來源:互聯網
上載者:User

標籤:c# sql封裝(二)

接 C# SQL封裝(一)

開始操作資料庫的測試 :

650) this.width=650;" title="03.png" alt="wKiom1lY66TTPTiFAAGALLf6b2c354.png-wh_50" src="https://s5.51cto.com/wyfs02/M00/9A/A4/wKiom1lY66TTPTiFAAGALLf6b2c354.png-wh_500x0-wm_3-wmp_4-s_2703394367.png" />

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBDome.com;
using DBDome.model;
using System.Data.SqlClient;
using System.Data;

namespace DBDome
{
    class Program
    {
        static void Main(string[] args)
        {
            User kayer_new = new User();
            kayer_new.name = "kayer";
            kayer_new.sex = 1;
            kayer_new.lv = 1;
            kayer_new.username = "Kayer";
            kayer_new.userpwd = "123";

            string into_sql = SQL_Structure.ADD_T_SQL<User>(kayer_new);
            Console.WriteLine(into_sql);
           
            SqlParameter[] a = SqlParameter_Structure.ADD_T_SQL<User>(kayer_new);
            string c =  SqlHelper.connectionString;
            Console.WriteLine(c);
           
            int i = SqlHelper.ExecteNonQuery(CommandType.Text, into_sql, a);
            if (i > 0)
            {
                Console.WriteLine("執行操作成功");
            }
            else
            {
                Console.WriteLine("執行操作失敗");
            }
            Console.Read();
        }
    }
}


結果 :

650) this.width=650;" title="01.png" style="float:none;" alt="wKiom1lY69PQp8XcAABnq4-cSKU413.png-wh_50" src="https://s4.51cto.com/wyfs02/M00/9A/A4/wKiom1lY69PQp8XcAABnq4-cSKU413.png-wh_500x0-wm_3-wmp_4-s_1869903138.png" />

650) this.width=650;" title="02.png" style="float:none;" alt="wKioL1lY69ODd6FIAABfzugm7rs978.png-wh_50" src="https://s5.51cto.com/wyfs02/M00/9A/A5/wKioL1lY69ODd6FIAABfzugm7rs978.png-wh_500x0-wm_3-wmp_4-s_632512952.png" />


刪 - 改 - 查 的會陸續更新 ------


本文出自 “Better_Power_Wisdom” 部落格,請務必保留此出處http://aonaufly.blog.51cto.com/3554853/1943854

C# SQL封裝(二)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.