SQL Server CE 插入多行 [英] SQL Server CE Insert multiple rows
本文介绍了SQL Server CE 插入多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试插入 SQL Server CE .sdf
数据库文件.我正在使用这两个命令,但是当我尝试从 C# 插入它时出现错误:
I am trying to insert into a SQL Server CE .sdf
database file. I'm using these two commands, but I am getting an error when I am trying to insert it from C#:
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
VALUES (5068652,'18111111293376', 0);
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
VALUES (5068642,'18111111293370', 0);
任何想法如何实现这一点?提前致谢;)
Any ideas how to accomplish this? Thanks in advance ;)
public void ExecuteCommand2(string commandText, CommandType commandType, SqlCeConnection sqlConn, SqlCeTransaction sqlTrans, params SqlCeParameter[] parameters)
{
var command = new SqlCeCommand(commandText);
command.Connection = sqlConn;
command.CommandType = commandType;
//command.CommandTimeout = 10000;
if (sqlTrans != null)
command.Transaction = sqlTrans;
command.ExecuteNonQuery();
if (command != null)
{
command.Dispose();
}
command = null;
}
推荐答案
你试过命令了吗:
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
select 5068652,'18111111293376', 0
union all
select 5068642,'18111111293370', 0
这篇关于SQL Server CE 插入多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文