0
我創建了一個FTS這article 我有一個類型的varbinary(最大),我填充了MSWord文件(.doc)和另一列字類型(填充.doc)的列, 。 當我運行此腳本,輸出是空FTS使用故障
SELECT
name,
content
FROM tblWordFiles
WHERE FREETEXT(content, '1');
或
SELECT
name,
content
FROM tblWordFiles
WHERE contains(content, '1');
哪裏是我的問題嗎?
ooooooo! 我用這個代碼來填充數據庫(C#)
SqlConnection cn = new SqlConnection(@"Data Source=MJ;Initial Catalog=Test_word_binary;Integrated Security=True");
string command = "insert into tblWordFiles (type,content) values('doc','@c')";
SqlCommand cm = new SqlCommand(command, cn);
DialogResult dg = openFileDialog1.ShowDialog();
if (dg == DialogResult.OK)
{
// Create a new stream to load this photo into
System.IO.FileStream stream = new System.IO.FileStream(openFileDialog1.FileNames[0], System.IO.FileMode.Open, System.IO.FileAccess.Read);
// Create a buffer to hold the stream bytes
byte[] buffer = new byte[stream.Length];
// Read the bytes from this stream
stream.Read(buffer, 0, (int)stream.Length);
// Now we can close the stream
stream.Close();
cm.Parameters.Add("@c", SqlDbType.VarBinary).Value = buffer;
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
}
謝謝keeperOfTheSoul – 2009-09-02 12:57:44