473,320 Members | 1,802 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,320 software developers and data experts.

Object operand error message

In VS 2008, why can I not do:

trace.warn("parameters(3) = " & parameters(3).value)

I get an error:

Option Strict on prohibits operands of type Object for operator '&'

This worked fine in 2003.

parameters is defined as:

Dim parameters As SqlParameter() = { _
New SqlParameter("@ScreenQuestionID", SqldbType.Int), _
....

Thanks,

Tom
Sep 13 '08 #1
1 979
tshad wrote:
In VS 2008, why can I not do:

trace.warn("parameters(3) = " & parameters(3).value)

I get an error:

Option Strict on prohibits operands of type Object for operator '&'

This worked fine in 2003.

parameters is defined as:

Dim parameters As SqlParameter() = { _
New SqlParameter("@ScreenQuestionID", SqldbType.Int), _
...

Thanks,

Tom
Because the Value property of the SqlParameter class is of the type Object.

You can cast the object to the actual type that you have stored in the
parameter, the & operator will then use the ToString method to format it
into a string:

trace.warn("parameters(3) = " & DirectCast(parameters(3).Value, Integer))

Or you can simply use the ToString method on the object to get the
string representation:

trace.warn("parameters(3) = " & parameters(3).Value.ToString())

--
Göran Andersson
_____
http://www.guffa.com
Sep 13 '08 #2

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

Similar topics

2
by: Kostatus | last post by:
The following code worked perfectly fine until i modified an unrelated part of the program: this->dungArea.mBlocked = mioS.mio_dungArea.mFlags & isBlocked; after that i started getting the...
54
by: tshad | last post by:
I have a function: function SalaryDisplay(me) { var salaryMinLabel = document.getElementById("SalaryMin"); salaryMinLabel.value = 200; alert("after setting salaryMinLabel = " +...
30
by: jimjim | last post by:
Hello, This is a simple question for you all, I guess . int main(){ double *g= new double; *g = 9; delete g; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl; *g =...
28
by: jimjim | last post by:
Hello, This is a simple question for you all, I guess . int main(){ double *g= new double; *g = 9; delete g; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl; *g =...
14
by: fuchsia555 | last post by:
Is there anyway to hide php error messages? Because i have in my php code error but it redirecting after 1 sec and shows my hosting path and php error number, but this error doesn't effect anything.
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.