.NET?????????????????????????
???????????? ???????[ 2015/4/15 11:00:11 ] ????????.NET ???????
?????????????????????????
????1. ???????????
????2. ???sql???????????
????3. ???sql??????Transaction
????4. ???sql??????SqlTransaction
????5. ???DataAdapter
????6. ???TransactionScope??SqlBulkCopy
????7. ?????????
????????????SQL Server?????????
????create table TestTable
????(
????Id int
??????Name nvarchar(20)
????)
?????????????????DataTable??????????????????
1.public class Tools
2.{
3. public static DataTable MakeDataTable()
4. {
5. DataTable table = new DataTable();
6.
7. //????DataTable????(schema)
8. table.Columns.Add("Id"?? Type.GetType("System.Int32"));
9. table.Columns.Add("Name"?? Type.GetType("System.String"));
10.
11. //????????
12. table.PrimaryKey = new DataColumn[] { table.Columns["ID"] };
13. table.Columns["Id"].AutoIncrement = true;
14. table.Columns["Id"].AutoIncrementSeed = 1;
15. table.Columns["Id"].ReadOnly = true;
16. return table;
17. }
18.
19. public static void MakeData(DataTable table?? int count)
20. {
21. if (table == null)
22. return;
23.
24. if (count <= 0)
25. return;
26.
27. DataRow row = null;
28.
29. for (int i = 1; i <= count; i++)
30. {
31. //????????μ?DataRow????(???????????)
32. row = table.NewRow();
33. row["Name"] = "Test" + i.ToString();
34. //????μ?DataRow
35. table.Rows.Add(row);
36. }
37. }
38.}
public class Tools
{
public static DataTable MakeDataTable()
{
DataTable table = new DataTable();
//????DataTable????(schema)
table.Columns.Add("Id"?? Type.GetType("System.Int32"));
table.Columns.Add("Name"?? Type.GetType("System.String"));
//????????
table.PrimaryKey = new DataColumn[] { table.Columns["ID"] };
table.Columns["Id"].AutoIncrement = true;
table.Columns["Id"].AutoIncrementSeed = 1;
table.Columns["Id"].ReadOnly = true;
return table;
}
public static void MakeData(DataTable table?? int count)
{
if (table == null)
return;
if (count <= 0)
return;
DataRow row = null;
for (int i = 1; i <= count; i++)
{
//????????μ?DataRow????(???????????)
row = table.NewRow();
row["Name"] = "Test" + i.ToString();
//????μ?DataRow
table.Rows.Add(row);
}
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11