Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Problem in String Manipulation


Reply
 
Thread Tools Display Modes
  #1  
Old 06-26-2003, 12:13 AM
jenson jenson is offline
Newcomer
 
Join Date: Jun 2003
Posts: 24
Unhappy Problem in String Manipulation


I guess i have problem in string manipulation...

If i type in "Select Admin_Id, Name From YYY"

How should i break up the sentence??
I tried,
Begin = Left(strData,7)
End = (Instr(strData,",")-1)
Length = End - Begin
New String = Mid(strData, Begin, Length)

I dun understand the last part of the 'NEW STRING' command.
The above what i understand is use for getting "Admin_Id" from the strData...But how should i retrieve Name??

What if i have another command like
"Select Admin_Id, Name, Venue From YYY"
How do i retrieve the "Venue" in the strData??

Can any Guru pls help me...
Reply With Quote
  #2  
Old 06-26-2003, 04:22 AM
Bram88 Bram88 is offline
Newcomer
 
Join Date: Jun 2003
Posts: 4
Default

Quote:
Originally Posted by jenson

Begin = Left(strData,7)
End = (Instr(strData,",")-1)
Length = End - Begin
New String = Mid(strData, Begin, Length)



The Left function returns a string (the first 7 characters of strData) and not a number. I guess you meant Begin = 7.

Have you already tried the Split function? It splits the function into an array of strings using the comma (or another character) as a seperator.
Reply With Quote
  #3  
Old 06-26-2003, 08:38 PM
jenson jenson is offline
Newcomer
 
Join Date: Jun 2003
Posts: 24
Default

I found from w3schools...
http://www.w3schools.com/ado/ado_display.asp

Dim x, Response

x = "Admin_Id" & "Name" & "Venue"

do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value)
next
Response.Write
rs.MoveNext
loop

Its seems better but it prompt "Could not find procedure 'Admin_IdNameVenue'."

Any guru can explain to me what happen...

Last edited by jenson; 06-26-2003 at 08:44 PM.
Reply With Quote
  #4  
Old 06-26-2003, 09:14 PM
blindwig's Avatar
blindwig blindwig is offline
Ultimate Contributor

* Expert *
 
Join Date: Jun 2003
Location: New York, NY
Posts: 1,929
Default

Quote:
Originally Posted by jenson
I found from w3schools...
http://www.w3schools.com/ado/ado_display.asp

Dim x, Response

x = "Admin_Id" & "Name" & "Venue"

do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value)
next
Response.Write
rs.MoveNext
loop

Its seems better but it prompt "Could not find procedure 'Admin_IdNameVenue'."

Any guru can explain to me what happen...


Well, the line
Code:
x = "Admin_Id" & "Name" & "Venue"
is going to assign x the string value of "Admin_IdNameVenue". I would assume that the "for each" command needs some kind of delimited between the parameters so it can seperate them out.
I think you should be doing something more like this
Code:
x = "Admin_Id" & strDelimiter & "Name" & strDelimiter & "Venue"
__________________
"Fortunately, I live in the United States of America, where we are gradually coming to understand that nothing we do is ever our fault, especially if it is really stupid." -Dave Barry
Reply With Quote
  #5  
Old 06-26-2003, 11:20 PM
jenson jenson is offline
Newcomer
 
Join Date: Jun 2003
Posts: 24
Default

Quote:
Originally Posted by blindwig
Quote:
Originally Posted by jenson
I found from w3schools...
http://www.w3schools.com/ado/ado_display.asp

Dim x, Response

x = "Admin_Id" & "Name" & "Venue"

do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value)
next
Response.Write
rs.MoveNext
loop

Its seems better but it prompt "Could not find procedure 'Admin_IdNameVenue'."

Any guru can explain to me what happen...


Well, the line
Code:
x = "Admin_Id" & "Name" & "Venue"
is going to assign x the string value of "Admin_IdNameVenue". I would assume that the "for each" command needs some kind of delimited between the parameters so it can seperate them out.
I think you should be doing something more like this
Code:
x = "Admin_Id" & strDelimiter & "Name" & strDelimiter & "Venue"



But it does not reconginze strDelimiter when debugging...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a file in dat question ? murphys General 5 11-06-2002 08:34 PM
Open an associated Text Document knoxitis General 19 05-01-2002 11:26 PM
Shareware Registry Protection Technigue karachi999 General 2 01-21-2002 02:40 PM
Loop to format file kingesk General 2 09-10-2000 05:01 PM
File format problem kingesk General 1 09-08-2000 04:52 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->