🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
6 messages
6 total messages Started by James Peterson Fri, 08 Apr 2005 13:11
ADOCommand
#764
Author: James Peterson
Date: Fri, 08 Apr 2005 13:11
14 lines
1392 bytes
 is there a way to insert a Stream into an ADOCommand ?

Forexample
you have a RichText1 and you wanted to save it with formating into the
following ADOCommond.

  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,
SerializedDate, SerializedTime, "+fields;
  comdtext += ")values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',
"+SerialDate+", "+SerialTime+", ";
  comdtext += values+")";
  ADOCommand2->CommandType = cmdText;
  ADOCommand2->CommandText = comdtext;
  ADOCommand2->Execute();
Re: ADOCommand
#772
Author: Viatcheslav V. Vassiliev
Date: Sat, 09 Apr 2005 07:00
33 lines
2124 bytes
Use parameters.

insert into (blobfield) values (:blob)

Then set parameter to anything you need, including stream or string that 
contains quotes or line breaks.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"James Peterson" <jpeterson@romanmealmilling.com> �������/�������� � 
�������� ���������: news:42568316$1@newsgroups.borland.com...
> is there a way to insert a Stream into an ADOCommand ?
>
> Forexample
> you have a RichText1 and you wanted to save it with formating into the
> following ADOCommond.
>
>  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,
> SerializedDate, SerializedTime, "+fields;
>  comdtext += ")values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',
> "+SerialDate+", "+SerialTime+", ";
>  comdtext += values+")";
>  ADOCommand2->CommandType = cmdText;
>  ADOCommand2->CommandText = comdtext;
>  ADOCommand2->Execute();
>
> 
Re: ADOCommand
#775
Author: James Peterson
Date: Mon, 11 Apr 2005 11:54
58 lines
2839 bytes
so I can do the following

TStream *Blob
=ADODataSet1->CreateBlobStream(ADODataSet1->FieldByName("Notes"), bmWrite);
    try {
        RichEdit8->Lines->SaveToStream(Blob);
    }
    __finally {
        delete Blob;
    }
  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,
SerializedDate, SerializedTime, "+fields;
  comdtext += ",
Notes )values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',
"+SerialDate+", "+SerialTime+", ";
  comdtext += values+"(:Blob))";
  ADOCommand2->CommandType = cmdText;
  ADOCommand2->CommandText = comdtext;
  ADOCommand2->Execute();


"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:42577d85@newsgroups.borland.com...
> Use parameters.
>
> insert into (blobfield) values (:blob)
>
> Then set parameter to anything you need, including stream or string that
> contains quotes or line breaks.
>
> file://------------------------------------------
> Regards,
> Vassiliev V. V.
> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> ADO.Net
> http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> MS Jet (Access) and Interbase (through OLEDB)
>
> "James Peterson" <jpeterson@romanmealmilling.com> �������/�������� �
> �������� ���������: news:42568316$1@newsgroups.borland.com...
> > is there a way to insert a Stream into an ADOCommand ?
> >
> > Forexample
> > you have a RichText1 and you wanted to save it with formating into the
> > following ADOCommond.
> >
> >  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,
> > SerializedDate, SerializedTime, "+fields;
> >  comdtext += ")values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',
> > "+SerialDate+", "+SerialTime+", ";
> >  comdtext += values+")";
> >  ADOCommand2->CommandType = cmdText;
> >  ADOCommand2->CommandText = comdtext;
> >  ADOCommand2->Execute();
> >
> >
>
>
Re: ADOCommand
#776
Author: Viatcheslav V. Vassiliev
Date: Tue, 12 Apr 2005 19:05
8 lines
3775 bytes
Drop TADOCommand to form. Set CommandText to

insert into data (Col1, BlobColumn) values (1, :Blob)

Now when you check Parameters you should see one parameter - Blob. In code 
do:

 ADOCommand1->Parameters->ParamByName(WideString("Blob"))->LoadFromFile("Unit1.cpp",ftBlob); ADOCommand1->Execute();There is also LoadFromStream(). Do not forget to set Stream->Position = 0 orcall Stream->Seek(0, soFromBeginning) before loading from it.//------------------------------------------Regards,Vassiliev V. V.http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +ADO.Nethttp://www.oledbdirect.com - The fastest way to access MS SQL Server,MS Jet (Access) and Interbase (through OLEDB)"James Peterson" <jpeterson@romanmealmilling.com> �������/�������� ��������� ���������: news:425a656e@newsgroups.borland.com...> so I can do the following>> TStream *Blob> =ADODataSet1->CreateBlobStream(ADODataSet1->FieldByName("Notes"),bmWrite);>    try {>        RichEdit8->Lines->SaveToStream(Blob);>    }>    __finally {>        delete Blob;>    }>  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,> SerializedDate, SerializedTime, "+fields;>  comdtext += ",> Notes )values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',> "+SerialDate+", "+SerialTime+", ";>  comdtext += values+"(:Blob))";>  ADOCommand2->CommandType = cmdText;>  ADOCommand2->CommandText = comdtext;>  ADOCommand2->Execute();>>> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message> news:42577d85@newsgroups.borland.com...>> Use parameters.>>>> insert into (blobfield) values (:blob)>>>> Then set parameter to anything you need, including stream or string that>> contains quotes or line breaks.>>>> file://------------------------------------------>> Regards,>> Vassiliev V. V.>> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +>> ADO.Net>> http://www.oledbdirect.com - The fastest way to access MS SQL Server,>> MS Jet (Access) and Interbase (through OLEDB)>>>> "James Peterson" <jpeterson@romanmealmilling.com> �������/�������� �>> �������� ���������: news:42568316$1@newsgroups.borland.com...>> > is there a way to insert a Stream into an ADOCommand ?>> >>> > Forexample>> > you have a RichText1 and you wanted to save it with formating into the>> > following ADOCommond.>> >>> >  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,>> > SerializedDate, SerializedTime, "+fields;>> >  comdtext +=")values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',>> > "+SerialDate+", "+SerialTime+", ";>> >  comdtext += values+")";>> >  ADOCommand2->CommandType = cmdText;>> >  ADOCommand2->CommandText = comdtext;>> >  ADOCommand2->Execute();>> >>> >>>>>>>
Re: ADOCommand
#784
Author: James Peterson
Date: Tue, 19 Apr 2005 15:45
78 lines
4917 bytes
doing if this way gives me the following error:

 Project raised exception class EoleEception with message 'Not Enough
Stroage is available to complete this operation'.
here is the revamped code

TStringStream *Blob = new TStringStream("");
    try {
        RichEdit8->Lines->SaveToStream(Blob);
 comdtext = "insert into data (ItemNumber, UserLog, Date, Time,
SerializedDate, SerializedTime, "+fields;
  comdtext += ",
Notes )values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',
"+SerialDate+", "+SerialTime+", ";
  comdtext += values+", :BlobNotes)";
  RichEdit8->Text = comdtext;
  ADOCommand2->CommandType = cmdText;
  ADOCommand2->CommandText = comdtext;
  Blob->Position = 0;

ADOCommand2->Parameters->ParamByName(WideString("BlobNotes"))->LoadFromStrea
m(Blob, ftBlob);
  ADOCommand2->Execute();
  }
  __finally {
        delete Blob;
   }

----------------------------------------------------------------------------
---------------------------------------------
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:425c1c03@newsgroups.borland.com...
> Drop TADOCommand to form. Set CommandText to
>
> insert into data (Col1, BlobColumn) values (1, :Blob)
>
> Now when you check Parameters you should see one parameter - Blob. In code
> do:
>
>
ADOCommand1->Parameters->ParamByName(WideString("Blob"))->LoadFromFile("Unit
1.cpp",ftBlob); ADOCommand1->Execute();There is also LoadFromStream(). Do
not forget to set Stream->Position = 0 orcall Stream->Seek(0,
soFromBeginning) before loading from
it.//------------------------------------------Regards,Vassiliev V.
V.http://www.managed-vcl.com - using .Net objects in Delphi for Win32
+ADO.Nethttp://www.oledbdirect.com - The fastest way to access MS SQL
Server,MS Jet (Access) and Interbase (through OLEDB)"James Peterson"
<jpeterson@romanmealmilling.com> �������/�������� ��������� ���������:
news:425a656e@newsgroups.borland.com...> so I can do the following>> TStream
*Blob>
=ADODataSet1->CreateBlobStream(ADODataSet1->FieldByName("Notes"),bmWrite);>
try {>        RichEdit8->Lines->SaveToStream(Blob);>    }>    __finally {>
delete Blob;>    }>  comdtext = "insert into data (ItemNumber, UserLog,
Date, Time,> SerializedDate, SerializedTime, "+fields;>  comdtext += ",>
Notes )values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',>
"+SerialDate+", "+SerialTime+", ";>  comdtext += values+"(:Blob))";>
ADOCommand2->CommandType = cmdText;>  ADOCommand2->CommandText = comdtext;>
ADOCommand2->Execute();>>> "Viatcheslav V. Vassiliev"
<support@oledbdirect.com> wrote in message>
news:42577d85@newsgroups.borland.com...>> Use parameters.>>>> insert into
(blobfield) values (:blob)>>>> Then set parameter to anything you need,
including stream or string that>> contains quotes or line breaks.>>>>
file://------------------------------------------>> Regards,>> Vassiliev V.
V.>> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +>>
ADO.Net>> http://www.oledbdirect.com - The fastest way to access MS SQL
Server,>> MS Jet (Access) and Interbase (through OLEDB)>>>> "James Peterson"
<jpeterson@romanmealmilling.com> �������/�������� �>> �������� ���������:
news:42568316$1@newsgroups.borland.com...>> > is there a way to insert a
Stream into an ADOCommand ?>> >>> > Forexample>> > you have a RichText1 and
you wanted to save it with formating into the>> > following ADOCommond.>>
>>> >  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,>> >
SerializedDate, SerializedTime, "+fields;>> >  comdtext
+=")values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',>> >
"+SerialDate+", "+SerialTime+", ";>> >  comdtext += values+")";>> >
ADOCommand2->CommandType = cmdText;>> >  ADOCommand2->CommandText =
comdtext;>> >  ADOCommand2->Execute();>> >>> >>>>>>>
>
Re: ADOCommand
#786
Author: Viatcheslav V. Vassiliev
Date: Wed, 20 Apr 2005 06:27
102 lines
5846 bytes
http://support.microsoft.com/kb/q182423/
http://support.microsoft.com/default.aspx/kb/248668

Install newest MDAC from http://www.microsoft.com/downloads

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"James Peterson" <jpeterson@romanmealmilling.com> �������/�������� � 
�������� ���������: news:426527a1@newsgroups.borland.com...
> doing if this way gives me the following error:
>
> Project raised exception class EoleEception with message 'Not Enough
> Stroage is available to complete this operation'.
> here is the revamped code
>
> TStringStream *Blob = new TStringStream("");
>    try {
>        RichEdit8->Lines->SaveToStream(Blob);
> comdtext = "insert into data (ItemNumber, UserLog, Date, Time,
> SerializedDate, SerializedTime, "+fields;
>  comdtext += ",
> Notes )values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',
> "+SerialDate+", "+SerialTime+", ";
>  comdtext += values+", :BlobNotes)";
>  RichEdit8->Text = comdtext;
>  ADOCommand2->CommandType = cmdText;
>  ADOCommand2->CommandText = comdtext;
>  Blob->Position = 0;
>
> ADOCommand2->Parameters->ParamByName(WideString("BlobNotes"))->LoadFromStrea
> m(Blob, ftBlob);
>  ADOCommand2->Execute();
>  }
>  __finally {
>        delete Blob;
>   }
>
> ----------------------------------------------------------------------------
> ---------------------------------------------
> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> news:425c1c03@newsgroups.borland.com...
>> Drop TADOCommand to form. Set CommandText to
>>
>> insert into data (Col1, BlobColumn) values (1, :Blob)
>>
>> Now when you check Parameters you should see one parameter - Blob. In 
>> code
>> do:
>>
>>
> ADOCommand1->Parameters->ParamByName(WideString("Blob"))->LoadFromFile("Unit
> 1.cpp",ftBlob); ADOCommand1->Execute();There is also LoadFromStream(). Do
> not forget to set Stream->Position = 0 orcall Stream->Seek(0,
> soFromBeginning) before loading from
> it.//------------------------------------------Regards,Vassiliev V.
> V.http://www.managed-vcl.com - using .Net objects in Delphi for Win32
> +ADO.Nethttp://www.oledbdirect.com - The fastest way to access MS SQL
> Server,MS Jet (Access) and Interbase (through OLEDB)"James Peterson"
> <jpeterson@romanmealmilling.com> �������/�������� ��������� ���������:
> news:425a656e@newsgroups.borland.com...> so I can do the following>> 
> TStream
> *Blob>
> =ADODataSet1->CreateBlobStream(ADODataSet1->FieldByName("Notes"),bmWrite);>
> try {>        RichEdit8->Lines->SaveToStream(Blob);>    }>    __finally {>
> delete Blob;>    }>  comdtext = "insert into data (ItemNumber, UserLog,
> Date, Time,> SerializedDate, SerializedTime, "+fields;>  comdtext += ",>
> Notes )values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',>
> "+SerialDate+", "+SerialTime+", ";>  comdtext += values+"(:Blob))";>
> ADOCommand2->CommandType = cmdText;>  ADOCommand2->CommandText = 
> comdtext;>
> ADOCommand2->Execute();>>> "Viatcheslav V. Vassiliev"
> <support@oledbdirect.com> wrote in message>
> news:42577d85@newsgroups.borland.com...>> Use parameters.>>>> insert into
> (blobfield) values (:blob)>>>> Then set parameter to anything you need,
> including stream or string that>> contains quotes or line breaks.>>>>
> file://------------------------------------------>> Regards,>> Vassiliev 
> V.
> V.>> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 
> +>>
> ADO.Net>> http://www.oledbdirect.com - The fastest way to access MS SQL
> Server,>> MS Jet (Access) and Interbase (through OLEDB)>>>> "James 
> Peterson"
> <jpeterson@romanmealmilling.com> �������/�������� �>> �������� ���������:
> news:42568316$1@newsgroups.borland.com...>> > is there a way to insert a
> Stream into an ADOCommand ?>> >>> > Forexample>> > you have a RichText1 
> and
> you wanted to save it with formating into the>> > following ADOCommond.>>
>>>> >  comdtext = "insert into data (ItemNumber, UserLog, Date, Time,>> >
> SerializedDate, SerializedTime, "+fields;>> >  comdtext
> +=")values('"+ItemNo+"','"+userID+"','"+dated+"','"+timed+"',>> >
> "+SerialDate+", "+SerialTime+", ";>> >  comdtext += values+")";>> >
> ADOCommand2->CommandType = cmdText;>> >  ADOCommand2->CommandText =
> comdtext;>> >  ADOCommand2->Execute();>> >>> >>>>>>>
>>
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads