-
How do i represent a string as a column name?
How do i represent a string as a column name?
example: COLUMN_NAME = "SALES_10"
My Code:
dim i as integer
dim sStr as string
i = 10
sStr = "SALES_" & trim(str(i))
rs(sStr) = 9999 => this is ok
rs.update => generates an error
-
Re: How do i represent a string as a column name?
It is unclear what you want to do:
- build a string
- "represent a string" (???)
or update your recordset.
Please explain.
Roy
"Rob" <rphildawa@yahoo.com> wrote in message news:3cfae37a$1@10.1.10.29...
>
> How do i represent a string as a column name?
>
> example: COLUMN_NAME = "SALES_10"
>
> My Code:
>
> dim i as integer
> dim sStr as string
>
> i = 10
> sStr = "SALES_" & trim(str(i))
> rs(sStr) = 9999 => this is ok
> rs.update => generates an error
-
Re: How do i represent a string as a column name?
"Rob" <rphildawa@yahoo.com> wrote:
>
>How do i represent a string as a column name?
>
>example: COLUMN_NAME = "SALES_10"
>
>My Code:
>
>dim i as integer
>dim sStr as string
>
>i = 10
>sStr = "SALES_" & trim(str(i))
>rs(sStr) = 9999 => this is ok
>rs.update => generates an error
From what I see your "rs(sStr)" reference is perfectly fine. The "rs.update"
is failing for reasons not associated to the sStr usage. What error message
is being returned?
Guy Smith
-
Re: How do i represent a string as a column name?
Hi Guy!
The error says "Invalid Column Name" or something. I don't know how to substitute
a string as a column name. In clipper, i just place an ampersand (&) to
the variable in order to refer to its content. how do i do this in VB?
Thanks a lot for ur help.
"Guy Smith" <sf@afddsf.com> wrote:
>
>"Rob" <rphildawa@yahoo.com> wrote:
>>
>>How do i represent a string as a column name?
>>
>>example: COLUMN_NAME = "SALES_10"
>>
>>My Code:
>>
>>dim i as integer
>>dim sStr as string
>>
>>i = 10
>>sStr = "SALES_" & trim(str(i))
>>rs(sStr) = 9999 => this is ok
>>rs.update => generates an error
>
>From what I see your "rs(sStr)" reference is perfectly fine. The "rs.update"
>is failing for reasons not associated to the sStr usage. What error message
>is being returned?
>
>Guy Smith
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks