標籤: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封裝(二)