Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing strings of StringGrid in single database field

Status
Not open for further replies.

jackrabbithanna

Programmer
Aug 19, 2004
11
0
0
US
I'm creating a program to manage a database of invoices. Each invoice will have a parts list. The parts list has part number,price, quantity etc... I'm using a string grid to display and edit this data. The problem is how to store the strings in a single binary field in a paradox table. I've been playing with TBlobStreams and other streams but I can't get it right. I don't even know if its possible to store an array of strings in a single field. Any pointers or strategies would be appreciated. Here's the (unworkable) code I got so far: It compiles but gives an StreamError exception when executed

TMemoryStream *pns = new TMemoryStream;
TStream *pndatas ;
pndatas=dataMod->Invoice->CreateBlobStream(dataMod->Invoice->FieldByName("PartsList"),bmReadWrite);

lbPartNumber->Items->SaveToStream(pns);
pndatas->CopyFrom(pns,pns->Size);

delete pns;
delete pndatas;

dataMod->Invoice->Post();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top