How to change a field's size? 
Author Message
 How to change a field's size?

Hi,

Is it possible to change a fields size in an ADO recordset? I have an
updateable recordset, I'd like to update a filed who's size is 3 to accept a
string of up to 20 char. I won't actually be updating the database, I just
want to modify the recordset.

Example:

        Select Case rsAdmission.Fields("Admission_Type").Value
            Case 1
                rsAdmission.Fields("Admission_Type").Value = "Emergency"
            Case 2
                rsAdmission.Fields("Admission_Type").Value = "Semi-Urgent"
            Case 3
                rsAdmission.Fields("Admission_Type").Value = "Elective"

I tried cloning the recordset, but I was unable to modify the cloned
recordset as well.

I'm using VB6 SP5 with MDAC 2.5 SP1

Thanks
Steve



Tue, 07 Sep 2004 03:45:42 GMT  
 How to change a field's size?
Steve,
Use MSDataShape to add a new field to the recordset and then put the long
text into this new field instead of the original short one.
Eugene


Quote:
> Hi,

> Is it possible to change a fields size in an ADO recordset? I have an
> updateable recordset, I'd like to update a filed who's size is 3 to accept
a
> string of up to 20 char. I won't actually be updating the database, I just
> want to modify the recordset.

> Example:

>         Select Case rsAdmission.Fields("Admission_Type").Value
>             Case 1
>                 rsAdmission.Fields("Admission_Type").Value = "Emergency"
>             Case 2
>                 rsAdmission.Fields("Admission_Type").Value = "Semi-Urgent"
>             Case 3
>                 rsAdmission.Fields("Admission_Type").Value = "Elective"

> I tried cloning the recordset, but I was unable to modify the cloned
> recordset as well.

> I'm using VB6 SP5 with MDAC 2.5 SP1

> Thanks
> Steve



Tue, 07 Sep 2004 03:56:38 GMT  
 How to change a field's size?


Hi,

Is it possible to change a fields size in an ADO recordset? I have an
updateable recordset, I'd like to update a filed who's size is 3 to accept a
string of up to 20 char. I won't actually be updating the database, I just
want to modify the recordset.

Example:

        Select Case rsAdmission.Fields("Admission_Type").Value
            Case 1
                rsAdmission.Fields("Admission_Type").Value = "Emergency"
            Case 2
                rsAdmission.Fields("Admission_Type").Value = "Semi-Urgent"
            Case 3
                rsAdmission.Fields("Admission_Type").Value = "Elective"

I tried cloning the recordset, but I was unable to modify the cloned
recordset as well.

I'm using VB6 SP5 with MDAC 2.5 SP1

Thanks
Steve

No you can't *change* the size of an ADO Recordset field "on the fly".


Microsoft MVP (Visual Basic)



Tue, 07 Sep 2004 04:10:50 GMT  
 How to change a field's size?
Hi Steve,

There is no direct way to change fields properties on
opened recordset, but it is possible. You need to save
your recordset in XML format into Stream , modify that XML
to change filed's properies and load it back to recordset.
If you need example how to do that, then let me know and I
will e-mail it to you. It is too bigto post it here

Val

Quote:
>-----Original Message-----
>Steve,
>Use MSDataShape to add a new field to the recordset and
then put the long
>text into this new field instead of the original short
one.
>Eugene



>> Hi,

>> Is it possible to change a fields size in an ADO

recordset? I have an
Quote:
>> updateable recordset, I'd like to update a filed who's
size is 3 to accept
>a
>> string of up to 20 char. I won't actually be updating

the database, I just
Quote:
>> want to modify the recordset.

>> Example:

>>         Select Case rsAdmission.Fields

("Admission_Type").Value
Quote:
>>             Case 1
>>                 rsAdmission.Fields

("Admission_Type").Value = "Emergency"
Quote:
>>             Case 2
>>                 rsAdmission.Fields

("Admission_Type").Value = "Semi-Urgent"
Quote:
>>             Case 3
>>                 rsAdmission.Fields

("Admission_Type").Value = "Elective"
Quote:

>> I tried cloning the recordset, but I was unable to
modify the cloned
>> recordset as well.

>> I'm using VB6 SP5 with MDAC 2.5 SP1

>> Thanks
>> Steve

>.



Tue, 07 Sep 2004 04:06:12 GMT  
 How to change a field's size?
Thanks, I was thinking of doing that and an example would been very
welcomed.


Thanks a lot Val, and everyone who responded.


Quote:
> Hi Steve,

> There is no direct way to change fields properties on
> opened recordset, but it is possible. You need to save
> your recordset in XML format into Stream , modify that XML
> to change filed's properies and load it back to recordset.
> If you need example how to do that, then let me know and I
> will e-mail it to you. It is too bigto post it here

> Val

> >-----Original Message-----
> >Steve,
> >Use MSDataShape to add a new field to the recordset and
> then put the long
> >text into this new field instead of the original short
> one.
> >Eugene



> >> Hi,

> >> Is it possible to change a fields size in an ADO
> recordset? I have an
> >> updateable recordset, I'd like to update a filed who's
> size is 3 to accept
> >a
> >> string of up to 20 char. I won't actually be updating
> the database, I just
> >> want to modify the recordset.

> >> Example:

> >>         Select Case rsAdmission.Fields
> ("Admission_Type").Value
> >>             Case 1
> >>                 rsAdmission.Fields
> ("Admission_Type").Value = "Emergency"
> >>             Case 2
> >>                 rsAdmission.Fields
> ("Admission_Type").Value = "Semi-Urgent"
> >>             Case 3
> >>                 rsAdmission.Fields
> ("Admission_Type").Value = "Elective"

> >> I tried cloning the recordset, but I was unable to
> modify the cloned
> >> recordset as well.

> >> I'm using VB6 SP5 with MDAC 2.5 SP1

> >> Thanks
> >> Steve

> >.



Tue, 07 Sep 2004 04:41:51 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Changing 'field size' in existing table

2. Change field's Size property via code

3. HOW TO change field size and delete field

4. how to change field size and delete field MS ACCESS/VB

5. Can't change text field size using DAO; can't specify size using ALTER TABLE SQL

6. Change 'from' field

7. Change table field size in code

8. Change Table Fields Size ??

9. Changing the size of an existing field through code

10. changing field type/size in Access 97 using vb6

11. Changing text field size with code

12. Changing field size from code ?

 

 
Powered by phpBB® Forum Software