473,396 Members | 2,113 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,396 software developers and data experts.

[BC30108] 'convert' is a type and cannot be used as an expression

Hi everybody.
i am trying to run a report and it is showing some errors of datatime format.

xml with mistakes-->"fechadesde" and "Fechahasta" are filters that are declarated as string but they i want to convert as datetime.

Expand|Select|Wrap|Line Numbers
  1. <Query>
  2.         <DataSourceName>PEPITO</DataSourceName>
  3.         <CommandText>="USE " &amp; Parameters!bd.Value &amp; " EXEC SP_AYA_RS_CC '" &amp; Parameters!fechaDesde.Value &amp; "','" &amp; Parameters!fechaHasta.Value &amp; "','" &amp; Parameters!proveedorDesde.Value &amp; "','" &amp; Parameters!proveedorHasta.Value &amp; "','" &amp; Parameters!codFamDesde.Value &amp; "','" &amp; Parameters!codFamHasta.Value &amp; "'," &amp; Parameters!fecha.Value &amp; ",'" &amp; Parameters!empresa.Value &amp; "'"</CommandText>
  4.         <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
  5.       </Query>
to convert them i have changed from:
Expand|Select|Wrap|Line Numbers
  1. &amp; Parameters!fechaDesde.Value &amp; "','" &amp; Parameters!fechaHasta.Value &amp; "','"
to:

Expand|Select|Wrap|Line Numbers
  1. ... &amp; convert(datetime,Parameters!fechaDesde,103) &amp; "','" &amp; convert(datetime,Parameters!fechaHasta,103) &amp; ...
but it is giving me this error: [BC30108] 'convert' is a type and cannot be used as an expression

Anyone can help me?

thank you!
Feb 1 '13 #1
3 5775
Rabbit
12,516 Expert Mod 8TB
Aren't you using ASP.Net? And from your convert function call, you're using SQL Server correct?

Convert is a SQL Server function, not an ASP.Net function. The convert call will need to be within the quotes and the variable without. But if I am correct in that you are using SQL Server, there's no need to convert to a date time, it can do that implicitly.
Feb 1 '13 #2
@Rabbit
This xml file (rdl extension) give parameters to a stored procedure of SQL. I tried to change the variable type inside the procedure but it doesnt work so I decide to change it in the xml file, before it give parameteres to the stored procedure....
I am new with this... is possible you write down the sentence?

thks for all your help
Feb 1 '13 #3
Rabbit
12,516 Expert Mod 8TB
The data type in the stored procedure is DATETIME correct? And you're using SQL Server? What I'm saying is that SQL Server will do the conversion implicitly, you don't need to explicitly convert it unless you're using some sort of weird date time format. In which case you should get a different error. In that case, you will need to convert it. And I explain what you need to do in that case in my previous post.
The convert call will need to be within the quotes and the variable without.
Feb 1 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Davor | last post by:
This is what I want to do: int currentWord = 0; currentWord++; textBoxOtherLang.Text = orginalLanguage; But, I get a "Cannot implictly convert type 'char' to 'string'" error when trying to...
22
by: Christoph Boget | last post by:
I am getting an error (a few among many) for the following lines of code: retval.BrokerName = (( curRow == System.DBNull.Value ) ? SqlString.Null : (string)curRow ); retval.BrokerGroupId = ((...
7
by: Assimalyst | last post by:
Hi, I am trying to write some server side validator code in C#. I want to have a piece of code that can be used by all DropDownLists on a webform, giving a false value if the SelectedIndex is 0....
2
by: Patrick Olurotimi Ige | last post by:
When i convert:- this code from VB to C# Why do i get error "Cannot implicitly convert type 'object' to 'bool' VB --- If cmdcommand.Parameters("ReturnValue").Value = 1 Then lblStatus.Text =...
9
by: Andy Sutorius | last post by:
Hi, I am receiving the error when compiling the project, "cannot implicitly convert type object to string". The error points to this line of code and underlines the dtrRecipient:...
6
by: Tim Cartwright | last post by:
I have a page that has the login control on it, nothing else. This page inherits from a master page, neither page has any code in it. This page works perfectly when running on the WebDev debug web...
4
by: eelis.net | last post by:
Hi I tried to convert the following C# code to vb.net. code in C# ________________________________________________________________ using System; using System.Reflection; using...
13
by: fctk | last post by:
hello is it possible to determine the type of an expression? something like operator sizeof but for types... for example: typeof(5.0) --> returns "double" typeof(5+7) --> returns "int"
6
by: John | last post by:
The following code: int test = 1; bool isTrue = (bool)test; results in a compiler error: Cannot convert type 'int' to 'bool' wtf, any ideas on how to work around this?
2
by: ransaj | last post by:
objCompanyRequirement.Salary = Convert.ToInt32 (txtCRF_Salary.Text); cannot implicitly convert type 'int' to 'string' objCompanyRequirement.InterviewDate = ...
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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
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.