我有一个分配了控件的表单
这是我单击插入按钮时的代码
private void btnInsertRArtist_Click(object sender, EventArgs e)
{
SqlCommand comand = new SqlCommand("InsertRecordingArtists", conect);
comand.CommandType = CommandType.StoredProcedure;
try
{
if (txtboxRArtistName.Text == string.Empty || txtboxPlaceOB.Text == "")
{
errorProvider1.SetError(txtboxRArtistName, "Enter the Music category");
}
else
{
conect.Open();
comand.Parameters.AddWithValue("@RecordingArtistName", txtboxRArtistName.Text);
comand.Parameters.AddWithValue("@DateOfBirth", dateTimePicker1);
comand.Parameters.AddWithValue("@BirthPlace", txtboxPlaceOB.Text);
SqlDataAdapter adapt = new SqlDataAdapter(comand);
comand.ExecuteNonQuery();
txtboxRArtistName.Text = "";
}
}
finally
{
conect.Close();
}
}
但是当我插入数据时,就会出现这个异常
我可以在这里做什么...我的商店程序也在这里
ALTER PROCEDURE InsertRecordingArtists
@RecordingArtistName text,
@DateOfBirth datetime,
@BirthPlace text
开始插入 [MusicCollection].[dbo].[RecordingArtists] ([RecordingArtistName],[DateOfBirth],[BirthPlace]) 值 (@RecordingArtistName,@DateOfBirth,@BirthPlace)