Загрузить файл в Бд
От: DemAS http://demas.me
Дата: 26.11.04 14:49
Оценка:
Добрый день.

Делаю вот так:

        SqlConnection    connection = new SqlConnection(SettingsSingleton.connectionString);
            connection.Open();

            string strSql = "update icon set icon = @icon where id = 1";
            SqlCommand    command = new SqlCommand(strSql, connection);
            command.Parameters.Add("@icon", SqlDbType.VarBinary);
            FileStream    file = new FileStream(_path, FileMode.Open);    
            byte[]    bytes = new byte[file.Length];
            file.Read(bytes, 0, (int) file.Length);
            command.Parameters[0].Value = bytes;
            command.ExecuteNonQuery();
            
      file.Close();        
      connection.Close();


Все работает. Но когда говорю:

        select icon from icon;


NULL

В чем дело ?

Заранее благодарен.
... << RSDN@Home 1.1.4 beta 3 rev. 220>>
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.