我有一个应用程序需要在列中存储一个值。值是代码中的字符串,列数据类型是nvarchar
.
foreach (DataRow row in dt.Rows)
{
//Generate a random length for randomKey range between 3 and 6 characters
Random randKey = new Random();
int randKeyLength = randKey.Next(3, 6);
//calculate randomKeyString
String randomKeyString = md5Prepare.gen_randomKeyString(randKeyLength);
//add randomKeyString to database
row["randomKey"] = randomKeyString;
}
当我检查数据库时,“randomKey”列没有改变。这里有什么问题?