重庆快乐十分

从文件中读取数据向并DB中导入

从文件中读取数据向并DB中导入

using System;
using System.Collections.Generic;
using http://www.like2us.com/doc/info-5c57cb64caaedd3383c4d3dd.html ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;
using System.Collections;

namespace Toos
{
public partial class Form1 : Form
{
private static string where = "";
public Form1()
{
InitializeComponent();
}

///


/// 地区编码取得
///

/// 更新列表
///
public string getAreaCode()
{
string areacode = "00000000000";
string sql = " SELECT MAX(CONVERT(NUMERIC(32),AREACODE)) AREACODE FROM TBL_AREAINFO ";
//DataTable dt = Util.loadSql(sql);
//string strConn = "server=192.168.100.68;uid=map;pwd=map;database=MapCDE";
SqlConnection conn = getCon();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds, "table");
DataTable dt = ds.Tables["table"];
if (dt.Rows.Count > 0)
{
areacode = (Int64.Parse(dt.Rows[0]["AREACODE"].ToString()) + 1).ToString();
}
return areacode;
}

///
/// 事务执行sql
///

///
///
public int ExcSql(string sql, SqlConnection conn)
{
int rows = -1;
//SqlConnection conn = getCon();
conn.Open();
SqlTransaction tran = conn.BeginTransaction();
try
{
SqlCommand comm = conn.CreateCommand();
comm.Connection = conn;
comm.Transaction = tran;
http://www.like2us.com/doc/info-5c57cb64caaedd3383c4d3dd.html mandType = CommandType.Text;
http://www.like2us.com/doc/info-5c57cb64caaedd3383c4d3dd.html mandText = sql;
rows = comm.ExecuteNonQuery();
http://www.like2us.com/doc/info-5c57cb64caaedd3383c4d3dd.html mit();
}
catch (SqlException)
{
tran.Rollback();
}
finally
{
conn.Close();
}
return rows;
}

///
/// 事务执行sql
///

///
///
public DataTable LoadSql(string sql, SqlConnection conn)
{
DataSet lds = new DataSet();
SqlDataAdapter lda = new SqlDataAdapter(sql, conn);
lda.Fill(lds, "table");
DataTable ldt = lds.Tables["table"];
return ldt;
}

public SqlConnection getCon()
{
string strConn = "server=192.168.100.68;uid=map;pwd=map;database=MapCDE";
SqlConnection conn = new SqlConnect

从文件中读取数据向并DB中导入的相关文档搜索

相关文档
安徽快3 重庆快乐十分 甘肃快3 天津福彩快乐十分 江西快3 河北快3 重庆快乐十分 江西快3 重庆快乐十分 澳门手机网投