怎么把unsigned char数组 放到SQLServer的binary字段?
例如: unsigned char wavedata[780]; //数据
如何向一个SQLServer的binary字段,写入和读取?
谢谢!
[解决办法]
这个是写的
unsigned char wavedata[780];//假设你的数据是准备好的。 TADOQuery *Query = new TADOQuery(Application); Query->ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ExtractFilePath(Application->ExeName) + "1.mdb;"; Query->SQL->Text = "insert into table1(ee)values('asddasd11')"; //注意这个ee字段的值,你要根据你的具体情况改一下。可以让他是你的记录的序号。 Query->ExecSQL(); TMemoryStream *data = new TMemoryStream(); data->Write(wavedata,780) ; Query->SQL->Text = "update table1 set asd =:PHOTO where ee ='asddasd11'" ; Query->Parameters->Items[0]->LoadFromStream(data,ftBlob) ; //ftTypedBinary //ftBlob这两个应该都可以 Query->ExecSQL(); Query->Close(); delete Query; delete data;