ibatis.net 入门demo 实现基本增删改查
1、项目架构体系 DAO(数据访问层) Domain(实体层) Text(表示层)
2、比较重要的是需要添加两个dll的引用,以及两个配置文件和一个XML文件
两个 IbatisNet.Common.dll 、 IbatisNet.DataMapper.dll 添加在DAO层里(版本1.0.0.0)
两个配置文件Provider.config、SqlMap.config以及Student.xml要放到启动项的bin/Debugg下
Provider.config 代码附上(这个配置算是比较全的了,我用sql server 2016版本的数据库调试没问题,里面的配置一般来说不需要动,直接复制就行,很多数据库及版本的都兼容了)
<?xml version="1.0" encoding="utf-8"?>
<providers
xmlns="http://ibatis.apache.org/providers"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <clear/>
<provider
name="sqlServer1.0"
description="Microsoft SQL Server, provider V1.0.3300.0 in framework .NET V1.0"
enabled="false"
assemblyName="System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" connectionClass="System.Data.SqlClient.SqlConnection"
commandClass="System.Data.SqlClient.SqlCommand"
parameterClass="System.Data.SqlClient.SqlParameter"
parameterDbTypeClass="System.Data.SqlDbType"
parameterDbTypeProperty="SqlDbType"
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
commandBuilderClass="System.Data.SqlClient.SqlCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="sqlServer4.0"
enabled="true"
description="Microsoft SQL Server, provider V4.0.0.0 in framework .NET V4.0"
assemblyName="System.Data, Version=4.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.SqlClient.SqlConnection"
commandClass="System.Data.SqlClient.SqlCommand"
parameterClass="System.Data.SqlClient.SqlParameter"
parameterDbTypeClass="System.Data.SqlDbType"
parameterDbTypeProperty="SqlDbType"
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
commandBuilderClass=" System.Data.SqlClient.SqlCommandBuilder"
usePositionalParameters = "false"
useParameterPrefixInSql = "true"
useParameterPrefixInParameter = "true"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="sqlServer1.1"
description="Microsoft SQL Server, provider V1.0.5000.0 in framework .NET V1.1"
enabled="false"
default="true"
assemblyName="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.SqlClient.SqlConnection"
commandClass="System.Data.SqlClient.SqlCommand"
parameterClass="System.Data.SqlClient.SqlParameter"
parameterDbTypeClass="System.Data.SqlDbType"
parameterDbTypeProperty="SqlDbType"
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
commandBuilderClass="System.Data.SqlClient.SqlCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="sqlServer2.0"
enabled="false"
description="Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0"
assemblyName="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.SqlClient.SqlConnection"
commandClass="System.Data.SqlClient.SqlCommand"
parameterClass="System.Data.SqlClient.SqlParameter"
parameterDbTypeClass="System.Data.SqlDbType"
parameterDbTypeProperty="SqlDbType"
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
commandBuilderClass=" System.Data.SqlClient.SqlCommandBuilder"
usePositionalParameters = "false"
useParameterPrefixInSql = "true"
useParameterPrefixInParameter = "true"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="sqlServer2005"
enabled="true"
description="Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0"
assemblyName="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.SqlClient.SqlConnection"
commandClass="System.Data.SqlClient.SqlCommand"
parameterClass="System.Data.SqlClient.SqlParameter"
parameterDbTypeClass="System.Data.SqlDbType"
parameterDbTypeProperty="SqlDbType"
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
commandBuilderClass=" System.Data.SqlClient.SqlCommandBuilder"
usePositionalParameters = "false"
useParameterPrefixInSql = "true"
useParameterPrefixInParameter = "true"
parameterPrefix="@"
allowMARS="true"
/>
<provider name="OleDb1.1"
description="OleDb, provider V1.0.5000.0 in framework .NET V1.1"
enabled="false"
assemblyName="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.OleDb.OleDbConnection"
commandClass="System.Data.OleDb.OleDbCommand"
parameterClass="System.Data.OleDb.OleDbParameter"
parameterDbTypeClass="System.Data.OleDb.OleDbType"
parameterDbTypeProperty="OleDbType"
dataAdapterClass="System.Data.OleDb.OleDbDataAdapter"
commandBuilderClass="System.Data.OleDb.OleDbCommandBuilder"
usePositionalParameters="true"
useParameterPrefixInSql="false"
useParameterPrefixInParameter="false"
parameterPrefix=""
allowMARS="false"
/>
<provider name="OleDb2.0"
description="OleDb, provider V2.0.0.0 in framework .NET V2"
enabled="false"
assemblyName="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.OleDb.OleDbConnection"
commandClass="System.Data.OleDb.OleDbCommand"
parameterClass="System.Data.OleDb.OleDbParameter"
parameterDbTypeClass="System.Data.OleDb.OleDbType"
parameterDbTypeProperty="OleDbType"
dataAdapterClass="System.Data.OleDb.OleDbDataAdapter"
commandBuilderClass="System.Data.OleDb.OleDbCommandBuilder"
usePositionalParameters="true"
useParameterPrefixInSql="false"
useParameterPrefixInParameter="false"
parameterPrefix=""
allowMARS="false"
/>
<provider
name="Odbc1.1"
description="Odbc, provider V1.0.5000.0 in framework .NET V1.1"
enabled="false"
assemblyName="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.Odbc.OdbcConnection"
commandClass="System.Data.Odbc.OdbcCommand"
parameterClass="System.Data.Odbc.OdbcParameter"
parameterDbTypeClass="System.Data.Odbc.OdbcType"
parameterDbTypeProperty="OdbcType"
dataAdapterClass="System.Data.Odbc.OdbcDataAdapter"
commandBuilderClass="System.Data.Odbc.OdbcCommandBuilder"
usePositionalParameters="true"
useParameterPrefixInSql="false"
useParameterPrefixInParameter="false"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="Odbc2.0"
description="Odbc, provider V2.0.0.0 in framework .NET V2"
enabled="false"
assemblyName="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
connectionClass="System.Data.Odbc.OdbcConnection"
commandClass="System.Data.Odbc.OdbcCommand"
parameterClass="System.Data.Odbc.OdbcParameter"
parameterDbTypeClass="System.Data.Odbc.OdbcType"
parameterDbTypeProperty="OdbcType"
dataAdapterClass="System.Data.Odbc.OdbcDataAdapter"
commandBuilderClass="System.Data.Odbc.OdbcCommandBuilder"
usePositionalParameters="true"
useParameterPrefixInSql="false"
useParameterPrefixInParameter="false"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="oracle9.2"
description="Oracle, Oracle provider V9.2.0.401"
enabled="false"
assemblyName="Oracle.DataAccess, Version=9.2.0.401, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionClass="Oracle.DataAccess.Client.OracleConnection"
commandClass="Oracle.DataAccess.Client.OracleCommand"
parameterClass="Oracle.DataAccess.Client.OracleParameter"
parameterDbTypeClass="Oracle.DataAccess.Client.OracleDbType"
parameterDbTypeProperty="OracleDbType"
dataAdapterClass="Oracle.DataAccess.Client.OracleDataAdapter"
commandBuilderClass="Oracle.DataAccess.Client.OracleCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="false"
parameterPrefix=":"
useDeriveParameters="false"
allowMARS="false"
/>
<provider
name="oracle10.1"
description="Oracle, oracle provider V10.1.0.301"
enabled="false"
assemblyName="Oracle.DataAccess, Version=10.1.0.301, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionClass="Oracle.DataAccess.Client.OracleConnection"
commandClass="Oracle.DataAccess.Client.OracleCommand"
parameterClass="Oracle.DataAccess.Client.OracleParameter"
parameterDbTypeClass="Oracle.DataAccess.Client.OracleDbType"
parameterDbTypeProperty="OracleDbType"
dataAdapterClass="Oracle.DataAccess.Client.OracleDataAdapter"
commandBuilderClass="Oracle.DataAccess.Client.OracleCommandBuilder"
usePositionalParameters="true"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix=":"
useDeriveParameters="false"
allowMARS="false"
/>
<provider
name="oracleClient1.0"
description="Oracle, Microsoft provider V1.0.5000.0"
enabled="false"
assemblyName="System.Data.OracleClient, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" connectionClass="System.Data.OracleClient.OracleConnection"
commandClass="System.Data.OracleClient.OracleCommand"
parameterClass="System.Data.OracleClient.OracleParameter"
parameterDbTypeClass="System.Data.OracleClient.OracleType"
parameterDbTypeProperty="OracleType"
dataAdapterClass="System.Data.OracleClient.OracleDataAdapter"
commandBuilderClass="System.Data.OracleClient.OracleCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="false"
parameterPrefix=":"
allowMARS="false"
/>
<provider
name="ByteFx"
description="MySQL, ByteFx provider V0.7.6.15073"
enabled="false"
assemblyName="ByteFX.MySqlClient, Version=0.7.6.15073, Culture=neutral, PublicKeyToken=f2fef6fed1732fc1" connectionClass="ByteFX.Data.MySqlClient.MySqlConnection"
commandClass="ByteFX.Data.MySqlClient.MySqlCommand"
parameterClass="ByteFX.Data.MySqlClient.MySqlParameter"
parameterDbTypeClass="ByteFX.Data.MySqlClient.MySqlDbType"
parameterDbTypeProperty="MySqlDbType"
dataAdapterClass="ByteFX.Data.MySqlClient.MySqlDataAdapter"
commandBuilderClass="ByteFX.Data.MySqlClient.MySqlCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="MySql"
description="MySQL, MySQL provider 1.0.7.30072"
enabled="false"
assemblyName="MySql.Data, Version=1.0.7.30072, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionClass="MySql.Data.MySqlClient.MySqlConnection"
commandClass="MySql.Data.MySqlClient.MySqlCommand"
parameterClass="MySql.Data.MySqlClient.MySqlParameter"
parameterDbTypeClass="MySql.Data.MySqlClient.MySqlDbType"
parameterDbTypeProperty="MySqlDbType"
dataAdapterClass="MySql.Data.MySqlClient.MySqlDataAdapter"
commandBuilderClass="MySql.Data.MySqlClient.MySqlCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="?"
allowMARS="false"
/>
<provider name="SQLite3 Finisar"
description="SQLite, SQLite.NET provider V0.21.1869.3794"
enabled="false"
assemblyName="SQLite.NET, Version=0.21.1869.3794, Culture=neutral, PublicKeyToken=c273bd375e695f9c"
connectionClass="Finisar.SQLite.SQLiteConnection"
commandClass="Finisar.SQLite.SQLiteCommand"
parameterClass="Finisar.SQLite.SQLiteParameter"
parameterDbTypeClass="System.Data.DbType, System.Data"
parameterDbTypeProperty="DbType"
dataAdapterClass="Finisar.SQLite.SQLiteDataAdapter"
commandBuilderClass="Finisar.SQLite.SQLiteCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="@"
setDbParameterPrecision="false"
setDbParameterScale="false"
allowMARS="false"
/>
<provider name="SQLite3"
description="SQLite, SQLite.NET provider V1.0.43.0"
enabled="false"
assemblyName="System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"
connectionClass="System.Data.SQLite.SQLiteConnection"
commandClass="System.Data.SQLite.SQLiteCommand"
parameterClass="System.Data.SQLite.SQLiteParameter"
parameterDbTypeClass="System.Data.SQLite.SQLiteType"
parameterDbTypeProperty="DbType"
dataAdapterClass="System.Data.SQLite.SQLiteDataAdapter"
commandBuilderClass="System.Data.SQLite.SQLiteCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="@"
setDbParameterPrecision="false"
setDbParameterScale="false"
allowMARS="false"
/>
<provider
name="Firebird1.7"
description="Firebird, Firebird SQL .NET provider V1.7.0.33200"
enabled="false"
assemblyName="FirebirdSql.Data.Firebird, Version=1.7.0.33200, Culture=neutral, PublicKeyToken=fa843d180294369d" connectionClass="FirebirdSql.Data.Firebird.FbConnection"
commandClass="FirebirdSql.Data.Firebird.FbCommand"
parameterClass="FirebirdSql.Data.Firebird.FbParameter"
parameterDbTypeClass="FirebirdSql.Data.Firebird.FbDbType"
parameterDbTypeProperty="FbDbType"
dataAdapterClass="FirebirdSql.Data.Firebird.FbDataAdapter"
commandBuilderClass="FirebirdSql.Data.Firebird.FbCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="@"
allowMARS="false"
/>
<provider
name="PostgreSql0.99.1.0"
description="PostgreSql, Npgsql provider V0.99.1.0"
enabled="false"
assemblyName="Npgsql, Version=0.99.1.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"
connectionClass="Npgsql.NpgsqlConnection"
commandClass="Npgsql.NpgsqlCommand"
parameterClass="Npgsql.NpgsqlParameter"
parameterDbTypeClass="NpgsqlTypes.NpgsqlDbType"
parameterDbTypeProperty="NpgsqlDbType"
dataAdapterClass="Npgsql.NpgsqlDataAdapter"
commandBuilderClass="Npgsql.NpgsqlCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix=":"
allowMARS="true"
/>
<provider
name="iDb2.10"
description="IBM DB2 Provider, V 10.0"
enabled="false"
assemblyName="IBM.Data.DB2.iSeries, Version=10.0.0.0,Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26, Custom=null" connectionClass="IBM.Data.DB2.iSeries.iDB2Connection"
commandClass="IBM.Data.DB2.iSeries.iDB2Command"
parameterClass="IBM.Data.DB2.iSeries.iDB2Parameter"
parameterDbTypeClass="IBM.Data.DB2.iSeries.iDB2DbType"
parameterDbTypeProperty="iDB2DbType"
dataAdapterClass="IBM.Data.DB2.iSeries.iDB2DataAdapter"
commandBuilderClass="IBM.Data.DB2.iSeries.iDB2CommandBuilder"
usePositionalParameters="true"
useParameterPrefixInSql="false"
useParameterPrefixInParameter="false"
parameterPrefix=""
allowMARS="false"
/>
<provider
name="Informix"
description="Informix NET Provider, 2.81.0.0"
enabled="false"
assemblyName="IBM.Data.Informix, Version=2.81.0.0, Culture=neutral, PublicKeyToken=7c307b91aa13d208"
connectionClass="IBM.Data.Informix.IfxConnection"
commandClass="IBM.Data.Informix.IfxCommand"
parameterClass="IBM.Data.Informix.IfxParameter"
parameterDbTypeClass="IBM.Data.Informix.IfxType"
parameterDbTypeProperty="IfxType"
dataAdapterClass="IBM.Data.Informix.IfxDataAdapter"
commandBuilderClass="IBM.Data.Informix.IfxCommandBuilder"
usePositionalParameters = "true"
useParameterPrefixInSql = "false"
useParameterPrefixInParameter = "false"
useDeriveParameters="false"
allowMARS="false"
/>
</providers>
SqlMap.config 代码附上 (需要注意的有provider配置文件位置、数据库连接字符串provider的name及dataSource的连接字符串、映射文件的位置既XML)
<?xml version="1.0" encoding="utf-8" ?> <sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!--<properties resource="../../../properties.config"/>这个东西是变量用的,这里以最简单的实现说明,因此注释--> <settings>
<setting useStatementNamespaces="false"/>
</settings>
<!--provider配置文件位置-->
<providers resource="Provider.config"/> <!--数据库连接字符串-->
<database>
<provider name="sqlServer4.0"/>
<!--<dataSource name="TestDB" connectionString="Data Source=DESKTOP-V0V6TJ9\MSSQLSERVER2016;Initial Catalog=TextDB;Integrated Security=True;User ID=sa;Password=123;Max Pool Size=512;Connection Timeout=60"/>-->
<dataSource name="TestDB" connectionString="Data Source=DESKTOP-V0V6TJ9\MSSQLSERVER2016;Initial Catalog=TextDB;Persist Security Info=True;User ID=sa;Password=123;"/>
</database> <sqlMaps>
<sqlMap resource="Student.xml" />
<!--这个是指定映射文件的位置-->
</sqlMaps>
</sqlMapConfig>
Student.xml 代码附上 (自己配置)
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Ibatis" xmlns="http://ibatis.apache.org/mapping" xmlns:xls="http://www.w3.org/2001/XMLSchema-instance">
<resultMap id="SelectAllStudent" class="StudentModel">
<result property="Id" column="Id"/>
<result property="Name" column="Name"/>
</resultMap>
<statements>
<select id="SelectAllStudent" resultClass="Ibatis.Net.Domain.StudentModel">
<!--这个Id在程序中会用到,resultClass是类所在的程序位置(带命名空间)-->
select * from Students
</select>
<insert id ="InsertStudent" resultClass="Ibatis.Net.Domain.StudentModel" >
insert into students values(#Name#)
</insert>
<update id ="UpdateStudent" resultClass="Ibatis.Net.Domain.StudentModel" >
update students set name = #Name# where id = #Id#
</update>
<delete id ="DeleteStudent" resultClass="Ibatis.Net.Domain.StudentModel" >
delete students where id = #Id#
</delete>
</statements>
</sqlMap>
StudentModel.cs 代码附上
public class StudentModel
{
public int Id { get; set; } public string Name { get; set; }
}
StudentDao.cs 代码附上
public class StudentDao
{
public IList<StudentModel> GetList()
{ ISqlMapper mapper = Mapper.Instance();
//查询数据 这个"SelectAllPerson"就是xml映射文件的Id
IList<StudentModel> ListStudents = mapper.QueryForList<StudentModel>("SelectAllStudent", null); return ListStudents;
} public void AddList(string name)
{
StudentModel student = new StudentModel();
student.Name = name;
object abc = Getmapper().Insert("InsertStudent", student);
} public bool UpdateList(int id, string name)
{
StudentModel student = new StudentModel();
student.Id = id;
student.Name = name;
return Getmapper().Update("UpdateStudent", student) > ? true : false;
} public bool DeleteList(int id)
{
StudentModel student = new StudentModel();
student.Id = id;
return Getmapper().Delete("DeleteStudent", student) > ? true : false;
} public ISqlMapper Getmapper()
{
DomSqlMapBuilder builder = new DomSqlMapBuilder();
ISqlMapper map = builder.Configure("SqlMap.config");
return map;
}
}
Program.cs 代码附上 (测试代码)
class Program
{
static void Main(string[] args)
{
//初始状态
int status = ; //操作
while (status >= )
{
Console.WriteLine("");
Console.WriteLine("请输入指令:1、查询 2、增加 3、修改 4、删除 5、退出 !"); int num = Convert.ToInt32(Console.ReadLine());
switch (num)
{
case :
//查询方法
SearchList();
break;
case :
Console.WriteLine("请输入姓名!");
string strName = Console.ReadLine(); //增加方法
AddList(strName);
break;
case :
//修改方法
Console.WriteLine("请输入要修改的Id!");
int id = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入新名字");
string name = Console.ReadLine();
UpdateList(id, name);
break;
case :
//删除方法
Console.WriteLine("请输入要删除的Id!");
int idcopy = Convert.ToInt32(Console.ReadLine());
DeleteList(idcopy);
break;
case :
status = -;
break;
default:
Console.WriteLine("指令输入错误!");
break; } }
Environment.Exit(); //Console.ReadKey();
}
//创建Dao类
static StudentDao dao = new StudentDao();
public static void SearchList()
{
//查询数据
IList<StudentModel> ListPerson = dao.GetList();
foreach (StudentModel p in ListPerson)
{
Console.WriteLine(p.Id + p.Name);
}
} public static void AddList(string name)
{
//添加数据
dao.AddList(name);
} public static void UpdateList(int id, string name)
{
//修改数据
if (dao.UpdateList(id, name))
{
Console.WriteLine("修改成功!");
}
else
{
Console.WriteLine("修改失败!");
};
} public static void DeleteList(int id)
{
//删除数据
if (dao.DeleteList(id))
{
Console.WriteLine("删除成功!");
}
else
{
Console.WriteLine("删除失败!");
}; }
}
3、数据库 库名TextDB
注:如果中间出现问题,报异常了,自己写个try catch,查看一下详细信息(重点看的几个属性InnerException、Message、StackTrace),具体了解到哪里出错进行修改!
ibatis.net 入门demo 实现基本增删改查的更多相关文章
- android 入门 006(sqlite增删改查)
android 入门 006(sqlite增删改查) package cn.rfvip.feb_14_2_sqlite; import android.content.Context; import ...
- node.js入门学习(四)--Demo图书的增删改查
需求:图书的增删改查,图书数据保存在data.json文件中. 1.Demo结构: 2.首先下载安装node.js,配置环境变量:参考博客 3.项目初始化 1)创建项目根目录node-hello,进入 ...
- Node.js、express、mongodb 入门(基于easyui datagrid增删改查)
前言 从在本机(win8.1)环境安装相关环境到做完这个demo大概不到两周时间,刚开始只是在本机安装环境并没有敲个Demo,从周末开始断断续续的想写一个,按照惯性思维就写一个增删改查吧,一方面是体验 ...
- VisualStudio2013内置SQLServer入门(二)--增删改查
前一篇 http://www.cnblogs.com/qixi233/p/4766451.html 这篇是sqlserver的操作 界面比较走心哈哈哈,将就着看,主要就是下面增删改查四个btn 对于s ...
- ASP.NET中使用Entity Framework开发增删改查的Demo(EF增删改查+母版页的使用)
这里更多的是当作随身笔记使用,记录一下学到的知识,以便淡忘的时候能快速回顾 这里是该项目的第二部分, 第一部分 第二部分(当前部分) 大完结版本 此Demo是新建了一个音乐类型的web,然后使用母版页 ...
- python2.7入门---操作mysql数据库增删改查
Python 标准数据库接口为 Python DB-API,Python DB-API为开发人员提供了数据库应用编程接口.Python 数据库接口支持非常多的数据库,你可以选择适合你项目的数据库: G ...
- Selenium入门13 cookie的增删改查
cookie的增删改查: 查询:get_cookies()查询所有cookie,get_cookie(cookie的name)获取单个cookie 删除:delete_cookie(cookie的na ...
- Mysql入门-对表数据的增删改查
这一部分是最简单的,也是最麻烦的.简单是因为其实只包括增删该插四个部分.大体上看,增加数据.删除数据.修改数据.查询数据都不麻烦啊,我们日常都是常用的.这个谁不会呢?以前在培训机构学mysql的时候, ...
- abp vnext 开发快速入门 2 实现基本增删改查
上篇说了abp vnext 的大体框架结构,本篇说下如何实现基础的增删改查.实现增删改查有以下几个步骤: 1.配置数据库连接 2.领域层(Domain)创建实体,Ef core 层配置Dbset( 用 ...
随机推荐
- freemarker报错之二
1.错误描述 五月 27, 2014 12:07:05 上午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...
- freemarker报错之四
1.错误描述 五月 28, 2014 9:56:48 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proce ...
- SDL 在指定窗口中绘图
SDL默认会自动创建绘图窗口,可以通过设置环境变量,让其在指定窗口绘图.代码如下: [cpp] view plaincopyprint? char sdl_var[64]; sprintf(sdl_v ...
- 小白学爬虫-设置Selenium+Chrome代理
微博登录限制了错误次数···加上Cookie大批账号被封需要从Cookie池中 剔除被封的账号··· 需要使用代理··· 无赖百度了大半天都是特么的啥玩意儿???结果换成了 Google手到擒来 分分 ...
- QOpenGLTexture 两个纹理叠加
如何做纹理混合? 方法是,定义多个QOpenGLTexture,然后在fragment shader中添加相应的变量,然后把texture bind到对应的uniform变量上. 废话不多说 text ...
- linux 安装沙盒virtualenv 、virtualenvwrapper
1.沙盒安装命令: 最新版本:sudo easy_install virtualenv或者sudo apt-get install virtualenv 指定版本:pip install virtua ...
- freemarker处理map的数据(二十)
1.简易说明 (1)map取值 (2)key取值 2.实现示例 <html> <head> <meta http-equiv="content-type&quo ...
- 简要分析javascript的选项卡和轮播图
选项卡 思路 1.按钮和展示的页面要对应:分别遍历,记住当前按钮的索引,让其成为展示页面的索引 2.只出现所对应的页面:所有的页面隐藏,只展示想要的页面 只展示js代码 for(var i=0;i&l ...
- [Luogu2991][USACO10OPEN]水滑梯Water Slides
题面戳我 题面描述 受到秘鲁的马丘比丘的新式水上乐园的启发,Farmer John决定也为奶牛们建一个水上乐园.当然,它最大的亮点就是新奇巨大的水上冲浪. 超级轨道包含 E (1 <= E &l ...
- [BZOJ1003] [ZJOI2006] 物流运输trans (最短路 & dp)
Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要n天才能运完.货物运输过程中一般要转停好几个码头.物流公司通常会设计一条固定的运输路线,以便对整个运输过程实施严格 ...