接 C# SQL封装(一)
开始操作数据库的测试 :
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();
}
}
}
结果 :
删 - 改 - 查 的会陆续更新 ------
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。