SQL 服务器 CE 插入多行
SQL Server CE Insert multiple rows
我正在尝试插入 SQL 服务器 CE .sdf
数据库文件。我正在使用这两个命令,但是当我尝试从 C# 插入它时出现错误:
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
VALUES (5068652,'18111111293376', 0);
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
VALUES (5068642,'18111111293370', 0);
有什么想法可以实现吗?提前致谢 ;)
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 服务器 CE .sdf
数据库文件。我正在使用这两个命令,但是当我尝试从 C# 插入它时出现错误:
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
VALUES (5068652,'18111111293376', 0);
INSERT INTO LazadaStaging (Id, TrackingNo, Flag)
VALUES (5068642,'18111111293370', 0);
有什么想法可以实现吗?提前致谢 ;)
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