I using C# to write a project to load file audio which formats .wav from SQL to DataGridView. But it was error .Can you help me,please ?
SqlConnection con = new SqlConnection("Data Source=CHANGEME1;AttachDbFilename=D:\\Code C#\\SimpleRec\\DataBase_Audio
SqlCommand com = new SqlCommand("select * from tbAudio where MaThe =136020379226", con);
con.Open();
DataTable dt = new DataTable();
SqlDataReader dr = com.ExecuteReader();
dt.Load(dr);
if (dt.Rows.Count == 1)
{
dataGridView1.DataSource = dt;
}
dr.Close();
con.Close();
byte[] stream = (byte[])dt.Rows[0][0];
File.WriteAllBytes("D:\\news.wma", stream);
Error is "The following exception occurred in the DataGridview"
Loading
toanhoi buiPosted Apr 1, 2011, 12:57 PM
Soft CornerPosted Apr 1, 2011, 12:35 PM
Why you are loading audio file into DataGrid?? Is your audio file having Some tabular Data to Show on Grid??
so, instead of loading into grid , load to media control.