Hi, I'm new to VB and .net so I may be mising something. I am trying to
dynamically build some SQL by appending to a string. Part of the SQL
comes from an mp3 id tag I have extracted from a file and stored in a
string. I can do all the normal stuff with the string like msgbox and I
can append it to another string but I cannot append to the end of it.
I have tried things like trim and using a string builder but it still
won't work.
Any advice would be greatly appreciated.
Cheers
Craig 8 4348
Craig,
It should be possible but withouth any code we cannot see anything, however
beside that the advices would go in this direcection.
Show otherwise some code as with the stringbuilder you are using as with a
normal classic string concatination it should go.
For Builing a SQL (select) string the SQLParameter class http://msdn.microsoft.com/library/de...classtopic.asp
I hope this helps?
Cor Hi, I'm new to VB and .net so I may be mising something. I am trying to dynamically build some SQL by appending to a string. Part of the SQL comes from an mp3 id tag I have extracted from a file and stored in a string. I can do all the normal stuff with the string like msgbox and I can append it to another string but I cannot append to the end of it.
I have tried things like trim and using a string builder but it still won't work.
* Two Beards <kr***********@ gmail.com> scripsit: Hi, I'm new to VB and .net so I may be mising something. I am trying to dynamically build some SQL by appending to a string. Part of the SQL comes from an mp3 id tag I have extracted from a file and stored in a string. I can do all the normal stuff with the string like msgbox and I can append it to another string but I cannot append to the end of it.
I have tried things like trim and using a string builder but it still won't work.
It's hard to give an answer without knowing the code. Make sure that
there are no 'ControlChar.Nu llChar' characters in your string. You can
use 'Strings.InStr' to detect the and then use 'Strings.Left' to cut out
the part in front of this characters.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
cheers, I did the following and found that the problem is control
characters. It seems that it returns a 30 char string every time. The
replace fixes the problem.
If album.EndsWith( ControlChars.Nu llChar) Then
album = album.Replace(C ontrolChars.Nul lChar, "")
MsgBox(album + "...test... ")
End If
Thanks for your help.
Herfried K. Wagner [MVP] wrote: * Two Beards <kr***********@ gmail.com> scripsit:
Hi, I'm new to VB and .net so I may be mising something. I am trying to dynamically build some SQL by appending to a string. Part of the SQL comes from an mp3 id tag I have extracted from a file and stored in a string. I can do all the normal stuff with the string like msgbox and I can append it to another string but I cannot append to the end of it.
I have tried things like trim and using a string builder but it still won't work.
It's hard to give an answer without knowing the code. Make sure that there are no 'ControlChar.Nu llChar' characters in your string. You can use 'Strings.InStr' to detect the and then use 'Strings.Left' to cut out the part in front of this characters.
You mentioned String.Left in your reply. I know that you can use code like a
= left(b,10) to get the 10 left most characters. However, the String class
member in the MSDN doesn't list a left or right method or property. Is
something like a = b.left(10) legal? I am trying to avoid the old Left and
right inherent in Visual Basic and stick to the string class but I't
cumbersome sometimes because using Left(a,10) where a is only "" gives a ""
result in visual basic but the string class a.substring(0,1 0) gives an error
when a="". By the way, I very much enjoy reading your replies to the news
group and have learned a lot from your replies to others as well as myself.
Thanks a lot.
"Herfried K. Wagner [MVP]" wrote: * Two Beards <kr***********@ gmail.com> scripsit: Hi, I'm new to VB and .net so I may be mising something. I am trying to dynamically build some SQL by appending to a string. Part of the SQL comes from an mp3 id tag I have extracted from a file and stored in a string. I can do all the normal stuff with the string like msgbox and I can append it to another string but I cannot append to the end of it.
I have tried things like trim and using a string builder but it still won't work.
It's hard to give an answer without knowing the code. Make sure that there are no 'ControlChar.Nu llChar' characters in your string. You can use 'Strings.InStr' to detect the and then use 'Strings.Left' to cut out the part in front of this characters.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
On 2004-09-04, Dennis <De****@discuss ions.microsoft. com> wrote: You mentioned String.Left in your reply. I know that you can use code like a = left(b,10) to get the 10 left most characters. However, the String class member in the MSDN doesn't list a left or right method or property. Is something like a = b.left(10) legal?
No, there is no .Left method, it's a shared function in the Strings (not
String, re-read Herfried's post carefully) class in the VB library. In
other words,
a = Left(b,10)
as you suspect.
I am trying to avoid the old Left and right inherent in Visual Basic and stick to the string class but I't cumbersome sometimes because using Left(a,10) where a is only "" gives a "" result in visual basic but the string class a.substring(0,1 0) gives an error when a="".
True, but in this case it doesn't matter, since your index is the result
of a search and thus the string is guaranteed to be that length. BTW,
depending on your specific needs here, it may be easier and more robust
to simply replace NullChar with an empty string.
* =?Utf-8?B?RGVubmlz?= <De****@discuss ions.microsoft. com> scripsit: You mentioned String.Left in your reply. I know that you can use code like a = left(b,10) to get the 10 left most characters. However, the String class member in the MSDN doesn't list a left or right method or property. Is something like a = b.left(10) legal?
No, it's not. You will have to use 'Substring' if you want to use a
method of your string object.
I am trying to avoid the old Left and right inherent in Visual Basic and stick to the string class but I't cumbersome sometimes because using
Newer is not necessarily better.
Left(a,10) where a is only "" gives a "" result in visual basic but the string class a.substring(0,1 0) gives an error when a="".
ACK. That's indeed very annoying. That's why I keep using the
functions provided in the 'Strings' module.
By the way, I very much enjoy reading your replies to the news group and have learned a lot from your replies to others as well as myself. Thanks a lot.
:-)
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
The primary reason that I was trying to stick to the classes rather than
revert to Visual Basic Language was the possibility that Microsoft will, in
some future relese of VB.Net, eliminate the older Visual Basic functions such
as Left, Right, and Mid. Hey, thank for your info and opinion on this topic.
"Herfried K. Wagner [MVP]" wrote: * =?Utf-8?B?RGVubmlz?= <De****@discuss ions.microsoft. com> scripsit: You mentioned String.Left in your reply. I know that you can use code like a = left(b,10) to get the 10 left most characters. However, the String class member in the MSDN doesn't list a left or right method or property. Is something like a = b.left(10) legal?
No, it's not. You will have to use 'Substring' if you want to use a method of your string object.
I am trying to avoid the old Left and right inherent in Visual Basic and stick to the string class but I't cumbersome sometimes because using
Newer is not necessarily better.
Left(a,10) where a is only "" gives a "" result in visual basic but the string class a.substring(0,1 0) gives an error when a="".
ACK. That's indeed very annoying. That's why I keep using the functions provided in the 'Strings' module.
By the way, I very much enjoy reading your replies to the news group and have learned a lot from your replies to others as well as myself. Thanks a lot.
:-)
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
* =?Utf-8?B?RGVubmlz?= <De****@discuss ions.microsoft. com> scripsit: The primary reason that I was trying to stick to the classes rather than revert to Visual Basic Language was the possibility that Microsoft will, in some future relese of VB.Net, eliminate the older Visual Basic functions such as Left, Right, and Mid.
NO! That's definitely not true. Microsoft has /never/ said that these
functions will be removed and there is absolutely no reason to remove
them. They are part of VB.NET now and will stay part of VB.NET. There
will be many changes to VB.NET, but I assume that these functions
are/will be one of the most stable parts of the language.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mattsniderppl |
last post by:
Hi, i'm relatively new to C++ from java and am having a difficult time
with pointers. I'm sure there is something simple that I am doing
wrong, but I can't seem to write this in a way that doesn't give me the
error "Unable to write to memmory." This is a static function that
receives a string that is the name of a file and an ifstream pointer.
It then concatenates the path string using the string.h function
strcat(char *, const char *) and...
|
by: Jonathan Buckland |
last post by:
Can someone give me an example how to append data without having to
load the complete XML file.
Is this possible?
Jonathan
|
by: Bob Rock |
last post by:
I already found an alternative way to accomplish this (using
ReadBytes), still I'd like to understand why I'm getting and error
reading a text file using the following method. The exception is
returned on the ReadString call.
public string BinaryRead(string fileName)
{
FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite);
|
by: Dakkar |
last post by:
I have a code like this and when i execute my program im taking this
error
unable to enumarate the process module
and here is my code
public bool proccescheck()
|
by: ashish ranjan |
last post by:
Hi there,
I want to fetch data from database ,convert it in xml then send this xml from server.In Javascript file i am trying to parse it and bind these data to some control like textbox in client page.But the xmlHttp.responseXML.documentElement returned from server is showing null:
I m using .Net,C#,(Ajax)
********************************************************
code snippet: serverPage.aspx.cs...
| |
by: ruvi |
last post by:
I am getting runtime error 3021 - Either EOF or BOF is true or the current record has been deleted.....
I have 2 combo boxes in a form- One for the client and the other for the project.
When the form loads, the client combo box gets populated with all the clients.
When a particular client is clicked, the project combo box gets populated with all the projects corresponding to that client.
So far, so good. Now when I click a project in the...
|
by: HYRY |
last post by:
I have the following questions, I am using Python 2.4.2
19167152 #1
11306608 #1
1. the address of a.append and list.append is different, can I get the
address of list.append from a.append?
19162720
|
by: lukethegooner |
last post by:
I can't see the wood for the tree's here, I have some code set up to
run through a bunch of delete queries, re-append fresh information to
local DB tables then run a report. But in the code below the Append
queires (stDocName40 thru' stDocName45) don't run (info does not
append to the table) when I execute the code.
I don't see why it doesn't work and I'm confused. Any ideas? I've
checked, double checked and triple checked for any...
|
by: mirajsen |
last post by:
Hello,
I have a data access page which is linked with a table. Users will enter the data through this particular DAP which is on a web server. I would like the DAP to capture and append the NT login ID of these users who are entering the data into the table.
I used the following code to capture the NTlogin.
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |