我想要输入文件中的一些文本,然后将文件中的特定数据上传到Access数据库 问题在于文本中包含“ ș”,“”,“¤”,“â”等字符,并且在插入comand时出现“输入字符串不是corect格式”错误。
private void adauga(string s)
{
string[] date = s.Split(';');
string sir;
for (int i = 0; i < date.Length; i++)
{
date[i].Trim();
}
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = con;
cmd.CommandText = "INSERT INTO Meniu([id_produs], [denumire_produs], [descriere], [pret], [kcal], [felul]) VALUES('" + Convert.ToInt32(date[0]) + "','" + date[1] + "','" + date[2] + "','" + Convert.ToInt32(date[3]) + "','" + Convert.ToInt32(date[4]) + "','" + Convert.ToInt32(date[5]) + "')";
cmd.ExecuteNonQuery();
}
这是用于从文件添加行的代码。