473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to include char & in a string in VB.NET?

I do not how to include char & in a string. In C, use \&. But I do not know
how in VB.NET? any one give me hand?

I have the following error message.

David

......
Syntax error: Missing operand after ''&''prot='' operator.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing
operand after ''&''prot='' operator.

Source Error:
Line 85:
Line 86:
'dsResource.Tables("Resource4Spec").Columns.Add("U RLQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+ PatientKey")
Line 87:
dsResource.Tables("Resource4Spec").Columns.Add("UR LQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+ PatientKey" &
"'&'" & "'prot='" & "+ Protocol")
Line 88:
Line 89: 'binding datagrid
Jan 4 '06 #1
3 1923
How about something like the following?

Dim s As String = "123&abc"

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"david" <da***@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
I do not how to include char & in a string. In C, use \&. But I do not
know
how in VB.NET? any one give me hand?

I have the following error message.

David

.....
Syntax error: Missing operand after ''&''prot='' operator.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing
operand after ''&''prot='' operator.

Source Error:
Line 85:
Line 86:
'dsResource.Tables("Resource4Spec").Columns.Add("U RLQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+
PatientKey")
Line 87:
dsResource.Tables("Resource4Spec").Columns.Add("UR LQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+
PatientKey" &
"'&'" & "'prot='" & "+ Protocol")
Line 88:
Line 89: 'binding datagrid

Jan 4 '06 #2
I think you just got mixed up with your single quotes (you have '&''prot= ,
notice the double single quotes).

I _think_ this is what you want:
"MethodName +" & "'?pkey='" & "+ PatientKey" & " + '&prot='" & "+ Protocol"

I also don't understand why you are breaking up ur string..wouldn't:
"MethodName + '?pkey=' + PatientKey + '&prot='+ Protocol"

work just as well and be a way easier to read?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"david" <da***@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
I do not how to include char & in a string. In C, use \&. But I do not
know
how in VB.NET? any one give me hand?

I have the following error message.

David

.....
Syntax error: Missing operand after ''&''prot='' operator.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing
operand after ''&''prot='' operator.

Source Error:
Line 85:
Line 86:
'dsResource.Tables("Resource4Spec").Columns.Add("U RLQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+
PatientKey")
Line 87:
dsResource.Tables("Resource4Spec").Columns.Add("UR LQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+
PatientKey" &
"'&'" & "'prot='" & "+ Protocol")
Line 88:
Line 89: 'binding datagrid

Jan 4 '06 #3
Thank you all.

I will try it tomorrow in workplace.
MethodName, PatientKey, Protocol are column names.

David

"Karl Seguin" wrote:
I think you just got mixed up with your single quotes (you have '&''prot= ,
notice the double single quotes).

I _think_ this is what you want:
"MethodName +" & "'?pkey='" & "+ PatientKey" & " + '&prot='" & "+ Protocol"

I also don't understand why you are breaking up ur string..wouldn't:
"MethodName + '?pkey=' + PatientKey + '&prot='+ Protocol"

work just as well and be a way easier to read?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"david" <da***@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
I do not how to include char & in a string. In C, use \&. But I do not
know
how in VB.NET? any one give me hand?

I have the following error message.

David

.....
Syntax error: Missing operand after ''&''prot='' operator.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing
operand after ''&''prot='' operator.

Source Error:
Line 85:
Line 86:
'dsResource.Tables("Resource4Spec").Columns.Add("U RLQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+
PatientKey")
Line 87:
dsResource.Tables("Resource4Spec").Columns.Add("UR LQuery",
Type.GetType("System.String"), "MethodName +" & "'?pkey='" & "+
PatientKey" &
"'&'" & "'prot='" & "+ Protocol")
Line 88:
Line 89: 'binding datagrid


Jan 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Gandalf | last post by:
Hello. I thought that strlen was only available after adding #include <string> to my c++ program, but apperently not, or the compiler is clever enough to find it by it self, or what? The...
10
by: Toke H?iland-J?rgensen | last post by:
Hello. I am quite new to the c++ language, and am still trying to learn it. I recently discovered how using include files would allow me to split up my code into smaller segments, instead of having...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
9
by: bill | last post by:
Forget the exact definition of difference between, #include <foo.h> and #include "bar.h" Normally foo.h is a standard header file, so it's path is not defined in compiler option, but I...
5
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
12
by: ABeck | last post by:
Hello List, I have ar more or less academical question. Can there arise runtime errors in a program, if the include of <string.h> has been forgotten? If all the arguments to the functions of...
6
by: cj | last post by:
I'm receiving an xml formatted string that I pull data from by reading it into an xml document like this: Dim doc As New Xml.XmlDocument doc.LoadXml(respstr) Dim co_name As Xml.XmlNodeList =...
2
by: ragged_hippy | last post by:
Hi, If I have a method that has string reference as a parameter, what happens if I pass a const char* variable to this method? One thought is that a temporary string will be created in the...
2
by: bvdamme | last post by:
Hello, In my httpd error_log file I get following error : PHP Warning: include(http://filuntu/php/includes/header.php? mask_menu1=1111&amp;mask_menu2=111111&amp;terug=/php/hoofdmenu.php) : failed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.