나는 교육 도메인 용 웹 사이트를 개발 중입니다. SQL Server 2008에서 Filestream
을 사용하여 이진 형식의 데이터베이스에 문서 (MS Word 또는 텍스트 파일)를 저장하려고합니다. 그러나 텍스트 상자에서 문서를 검색 할 수 없습니다.filestream in SQL Server 및 C# for aspx
string path = reader.GetString(0);
SqlFileStream stream1 = new SqlFileStream(path, (byte[])reader.GetValue(1), FileAccess.Read, FileOptions.SequentialScan, 0);
StreamReader fs = new StreamReader(stream1);
fs = File.OpenText(path);
string s = fs.ReadToEnd();
txtInput.Text = s;
//lblStatus.Text = "File Succesfully Read!"
fs.Close();
이 코드는 데이터베이스가 아닌 파일 시스템에 저장되어있는 문서에 대한 작업 다음과 같이
내 코드입니다. 그래서 나는 다음과 같은 코드를 시도 :이 코드에서
string path = reader.GetString(0);
SqlFileStream stream1 = new SqlFileStream(path, (byte[])reader.GetValue(1), FileAccess.Read, FileOptions.SequentialScan, 0);
StreamReader fs = new StreamReader(stream1);
fs = File.OpenText(path);
string s = fs.ReadToEnd();
txtInput.Text = s;
//lblStatus.Text = "File Succesfully Read!"
fs.Close();
을, 그것은 "경로에 액세스가 거부되었습니다"로 라인 fs = File.OpenText(path);
에 오류가 있습니다.
도와주세요!
SQL Server에서 사용하는 .MDF 파일에서 파일을 열려고합니까? –
당신의 "독자"는 무엇을 포함합니까 ?? 어떤 값을 거기에서 검색합니까 ?? –
제공되는 코드 스 니펫에서 차이점을 확인할 수 없습니다! – Cerebrus