【发布时间】:2011-09-20 05:11:04
【问题描述】:
字符串插入查询 = "";
MySqlTransaction 事务;
MySqlConnection con1 = new MySqlConnection();
MySqlDataAdapter 官方发展援助;
字符串服务器 = loggerConnectionString.servername;
con1.ConnectionString ="server="localhost";uid=root;pwd=;database=globasys;";
con1.Open();
交易 = con1.BeginTransaction();
ODA = new MySqlDataAdapter();
InsertQuery = "插入到 tr_config_unit_params " + Environment.NewLine;
InsertQuery += "(unit_param_id,unit_id, unit_param_desc, unit_param_opc_progid, unit_param_host, unit_param_link, unit_param_data_type, unit_param_type) " + Environment.NewLine;
InsertQuery +=“值(@unit_param_id,@unit_id,@unit_param_desc,@unit_param_opc_progid,@unit_param_host,@unit_param_link,@unit_param_data_type,@unit_param_type)”;;
ODA.InsertCommand =new MySqlCommand(InsertQuery, con1);
ODA.InsertCommand.Parameters.Add("@unit_param_id", MySqlDbType.Int32);
ODA.InsertCommand.Parameters.Add("@unit_id", MySqlDbType.Int32);
ODA.InsertCommand.Parameters.Add("@unit_param_desc", MySqlDbType.VarChar);
ODA.InsertCommand.Parameters.Add("@unit_param_opc_progid", MySqlDbType.VarChar);
ODA.InsertCommand.Parameters.Add("@unit_param_host", MySqlDbType.VarChar);
ODA.InsertCommand.Parameters.Add("@unit_param_link", MySqlDbType.VarChar);
ODA.InsertCommand.Parameters.Add("@unit_param_data_type", MySqlDbType.Int32);
ODA.InsertCommand.Parameters.Add("@unit_param_type", MySqlDbType.Int32);
ODA.InsertCommand.Transaction = 交易;
数据集 ds = new DataSet();
ds = dt;
int y= ODA.Update(dt,"tr_config_unit_params");
事务.Commit();
con1.关闭();
我已经使用 Mysqldataadapter.update() 插入了 150000 行,但是查询执行成功,但是在 MYSQL 的数据库表中没有插入行
提前致谢.....
【问题讨论】: