保存的数据经过字符串后会显示错误给定的路径格式不受支持,我做错了什么或者我把url
转换器代码放入错误的地方?错误System.NotSupportedException:不支持给定路径的格式
try
{
connect.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connect;
command.CommandText = string.Format("insert into RegisterItem([Name], [Url],[Description], [Price]) values('{0}','{1}','{2}','{3}')",
ItemName.Text,
ItemUrl.Text,
ItemDescription.Text,
ItemPrice.Text);
command.ExecuteNonQuery();
MessageBox.Show("Data Saved");
txtID1.Text = txtUsername.Text;
txtName1.Text = ItemName.Text;
txtDescription1.Text = ItemDescription.Text;
txtPrice1.Text = ItemPrice.Text;
ItemName.Text = "";
ItemDescription.Text = "";
ItemPrice.Text = "";
string str = ItemUrl.Text;
pictureBox1.ImageLocation = str;
string str1 = textBox1.Text;
Image img = Image.FromFile(str);
pictureBox1.Image = img;
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex);
}
finally
{
if (Connect != null) { connect.Close(); }
}
'ItemUrl'中有什么?我们看不到你的电脑:) – Pikoh
这是一个文本框,你输入的URL和图片将被加载到pictureBox1 –
但是引起异常的'ItemUrl.Text'值是什么? – slawekwin