ADO.NET 插入数据的问题
怎么同时向多张表插入数据,我是像下面这样 一个方法插入一张表,有没有更简单的方法?
public const string connstr = "server=.;database=test;Integrated Security=true";
static void Main(string[] args)
{
InsertData1("s003", "d003", "HiTerminal", "ABCDEFG", "STB Device", "12345678");
InsertData2("d003","InternetGatewayDevice.DeviceInfo.SoftwareVersion","1.0",0,2);
Console.ReadLine();
}
public static void InsertData1(string sid,string Device_varID, string Manufacturer,string OUI,string ProductClass,string SerialNumber)
{
SqlConnection conn = new SqlConnection(connstr);
string sqltext = "insert into A values (@sid,@Device_varID,@Manufacturer,@OUI,@ProductClass,@SerialNumber)";
SqlCommand cmd = new SqlCommand(sqltext,conn);
SqlParameter[] parameter = { new SqlParameter("@sid",sid),
new SqlParameter("@Device_varID",Device_varID),
new SqlParameter("@Manufacturer",Manufacturer),
new SqlParameter("@OUI",OUI),
new SqlParameter("@ProductClass",ProductClass),
new SqlParameter("@SerialNumber",SerialNumber)
};
cmd.Parameters.AddRange(parameter);
using (conn)
{
&n