android sqlite 导出sqlserver,SQLite导出数据到SQLServer

using System;

public interface IImportData

{

bool ImportData();

}

public class sqlite2sqlServer : IImportData

{

public virtual bool ImportData()

{

// TODO: implement

bool isSuccessful = true;

dedestinationTableName = Destination;

using (sqliteDataReader reader = sqliteHelper.ExecuteReader(sql_sqlite))

using (System.Data.sqlClient.sqlBulkCopy bulkCopy = new System.Data.sqlClient.sqlBulkCopy(PubConstant.ConnectionString))

{

{

bulkCopy.DestinationTableName = Destination;

try

{

bulkCopy.WriteToServer(reader);

}

catch (Exception ex)

{

isSuccessful = false;

throw new Exception(ex.Message);

}

}

}

return isSuccessful;

}

public virtual bool Hook()

{

// TODO: implement

Type t = typeof(T);

T dal = (T)Assembly.GetAssembly(t).CreateInstance(t.FullName);

//XPWY.DAL.QuestionFace dal = new DAL.QuestionFace();

MethodInfo methodInfo = dal.GetType().GetMethod("GetList",new Type[]{typeof(string)});

DataSet ds = methodInfo.Invoke(dal,new String[] { " BatchID=" + this.BatchID.ToString() }) as DataSet;

//GetList(" BatchID=" + this.BatchID.ToString());

if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)

{

return true;

}

else

{

return false;

}

}

public virtual bool ImportDataFromsqliteTosqlServer()

{

// TODO: implement

if(Hook)

{

return ImportData();

}

return false;

}

public System.Int32 BatchID;

public System.String Destination;

public System.String sql_sqlite;

}

public class QuestionFace : sqlite2sqlServer

{

public QuestionFace(System.Int32 nBatchID)

{

this.BatchID = nBatchID;

this.Destination="QuetionFace";

this.sql_sqlite="select * from QuestionFace";

}

public sealed bool ImportDataFromsqliteTosqlServer()

{

// TODO: implement

return base.ImportDataFromsqliteTosqlServer();

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值