我試圖找出是否有執行方式的倍數值在SQL服務器中插入而使用的參數,要精確,有這樣的命令:插入帶有參數的SQL Server的多行
com = new SqlCommand("insert into myTable values (@recID,@tagID)", con);
com.Parameters.Add("@recID", SqlDbType.Int).Value = recID;
com.Parameters.Add("@tagID", SqlDbType.Int).Value = tagID;
com.ExecuteNonQuery();
有沒有辦法執行多值單插入參數考慮到每個值的參數可能不同? (例如:tagID可能總是不同)
我一直在互聯網搜索,但迄今沒有運氣,在此先感謝,問候。
TVP參數,臨時表。 –
你可以使用一個表值參數:http://stackoverflow.com/questions/5595353/how-to-pass-table-value-parameters-to-stored-procedure-from-net-code –