Showing posts with label exception. Show all posts
Showing posts with label exception. Show all posts

Thursday, March 29, 2012

Error Rendering to Excel

Rendering a report to Excel (using Viewer-Export or SOPA-API), I get the
following error:
Exception of type
Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
thrown. (rrRenderingError) Onlinehilfe
Exception of type
Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
thrown.
Object reference not set to an instance of an object.
Rendering to any other format works fine.
What I found out:
The error happens only, if in the report header or footer is a textbox with
any expression e.g. Globals!PageNumber. If I remove all expressions,
rendering to excel works fine.
But I need this expressions !
Any solution or workaround available ?
Robert WeissWhat type of expression are you using in the Report Header or Footer?
I can't be data from a datasource.
Yosh
"rweiss" <rweiss@.discussions.microsoft.com> wrote in message
news:80FD9EC9-F2DD-46A3-8396-A4787E005977@.microsoft.com...
> Rendering a report to Excel (using Viewer-Export or SOPA-API), I get the
> following error:
> Exception of type
> Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
> thrown. (rrRenderingError) Onlinehilfe
> Exception of type
> Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
> thrown.
> Object reference not set to an instance of an object.
> Rendering to any other format works fine.
> What I found out:
> The error happens only, if in the report header or footer is a textbox
> with
> any expression e.g. Globals!PageNumber. If I remove all expressions,
> rendering to excel works fine.
> But I need this expressions !
> Any solution or workaround available ?
> Robert Weiss|||Any expression, for example Globals!PageNumber will do.
In my original report I had a lot of expressions referencing Code and
Parameters, but not the datasource.
I removed everything, now there is only header and footer with some
textboxes left.
As soon as there is any expression other than a literal in one of the
textboxes, the rendering exception occurs.
It's strange, because in other reports there is no problem with expressions
like Globals!PageNumber and rendering to excel.
Robert
"Yoshi" wrote:
> What type of expression are you using in the Report Header or Footer?
> I can't be data from a datasource.
> Yosh
>
> "rweiss" <rweiss@.discussions.microsoft.com> wrote in message
> news:80FD9EC9-F2DD-46A3-8396-A4787E005977@.microsoft.com...
> > Rendering a report to Excel (using Viewer-Export or SOPA-API), I get the
> > following error:
> >
> > Exception of type
> > Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
> > thrown. (rrRenderingError) Onlinehilfe
> > Exception of type
> > Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
> > thrown.
> > Object reference not set to an instance of an object.
> >
> > Rendering to any other format works fine.
> >
> > What I found out:
> > The error happens only, if in the report header or footer is a textbox
> > with
> > any expression e.g. Globals!PageNumber. If I remove all expressions,
> > rendering to excel works fine.
> >
> > But I need this expressions !
> >
> > Any solution or workaround available ?
> >
> > Robert Weiss
>
>

Monday, March 26, 2012

error parsing the query

hi all

I try to run the query below it throw me an exception, error parsing , is there anywat to resolve it?

SELECT TYPE2.list_price as 'TYPE2'
FROM TBL_MST_PRICE TYPE2
WHERE
price_grp_code = (SELECT price_grp_code FROM TBL_MST_PRICE_GRP WHERE prd_code = '' AND cust_code = '')

Sub-selects (nested select statements) are not supported by SQL CE. You will have to rephrase your query to use a join or use 2 select statements.

Wednesday, March 21, 2012

Error on Exporting Matrix to Excel

I get the following error when deploying my matrix to excel:
Reporting Services Error
----
Exception of type Microsoft.ReportingServices.ReportRendering.ReportRenderingException was thrown. (rrRenderingError) Get Online Help
Exception of type Microsoft.ReportingServices.ReportRendering.ReportRenderingException was thrown.
Object reference not set to an instance of an object.
----
Microsoft Reporting Services
I was previously able to export(prior to SP1). Any thoughts?
Thanks,
ShaneCan you post the RDL? Can you view source on the error page and see the
stack trace?
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Shane Castle" <ShaneCastle@.discussions.microsoft.com> wrote in message
news:E54AA708-882E-4960-98AB-A16A0F34A27C@.microsoft.com...
>I get the following error when deploying my matrix to excel:
> Reporting Services Error
> ----
> Exception of type
> Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
> thrown. (rrRenderingError) Get Online Help
> Exception of type
> Microsoft.ReportingServices.ReportRendering.ReportRenderingException was
> thrown.
> Object reference not set to an instance of an object.
> ----
> Microsoft Reporting Services
> I was previously able to export(prior to SP1). Any thoughts?
> Thanks,
> Shane

Friday, March 9, 2012

Error Msg

String or binary data would be truncated.
The statement has been terminated.

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.SqlClient.SqlException: String or binary data would be truncated.
The statement has been terminated.

Source Error:

Line 32: Line 33: Dim add As New SqlCommand(change, conn2)Line 34: add.ExecuteNonQuery()Line 35: conn2.Close()Line 36: Response.Redirect("ThankUReg.aspx")

hi there,

I have this error msg when i try to execute my register page..

What do they mean by string or binary data will be truncated? i've set my database value type to varchar(MAX).

still this error appears.. Looking forward for ur reply.

Yini

well it Does in fact mean that you are trying to insert data into a column that is not big enough for the data. Without knowing your db structure or seeing the SQL your actually using to insert i can't offer much more help. debug the process and maybe copy and paste your values into excel or something so you can run a LEN Function on them and see which one is too big.

hth,
mcm

|||

yinibabe:

i've set my database value type to varchar(MAX).

Have you set the data type to be varchar (max) for every string type column ? My advice is to again check all the columns for their data types, I think you are missing one column which may not allow the amount of data you are trying to insert for that column.

Hope this will help.

Wednesday, March 7, 2012

Error message?

Hi,

I have an error message:

Exception Details:System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value '@.qty' to data type int.

It doesnt say which line of code it is reffering to however..

Could someone help me?

The parameter for @.qty is Textbox1.Text - maybe I could make the text box int only or something?

My code is:

private bool ExecuteUpdate(int quantity)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True";

con.Open();

SqlCommand command = new SqlCommand();
command.Connection = con;
TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");
Label labname = (Label)FormView1.FindControl("Label3");
Label labid = (Label)FormView1.FindControl("Label13");

command.CommandText = "UPDATE Items SET Quantityavailable = Quantityavailable - @.qty WHERE productID=@.productID";
command.Parameters.Add("@.qty", TextBox1.Text);
command.Parameters.Add("@.productID", labid.Text);
command.ExecuteNonQuery();

con.Close();
return true;
}

private bool ExecuteInsert(String quantity)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True";

con.Open();

SqlCommand command = new SqlCommand();
command.Connection = con;
TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");
Label labname = (Label)FormView1.FindControl("Label3");
Label labid = (Label)FormView1.FindControl("Label13");

command.CommandText = "INSERT INTO Transactions (Usersname,Itemid,itemname,Date,Qty) VALUES ('@.User','@.productID','@.Itemsname',@.date,'@.qty')";
command.Parameters.Add("@.User", System.Web.HttpContext.Current.User.Identity.Name);
command.Parameters.Add("@.Itemsname", labname.Text);
command.Parameters.Add("@.productID", labid.Text);
command.Parameters.Add("@.qty", TextBox1.Text);
command.Parameters.Add("@.date", DateTime.Now.ToString());
command.ExecuteNonQuery();

con.Close();
return true;
}

protected void Button2_Click(object sender, EventArgs e)
{
TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;
ExecuteUpdate(Int32.Parse(TextBox1.Text) );
}

protected void Button2_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "Update")
{
TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;
ExecuteInsert(TextBox1.Text);
}
}

Thanks to anyone who can help!!!

Jon

jbear123:

Exception Details:System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value '@.qty' to data type int.

Well, the error clearly says that the server is expecting int type value for the parameter called @.qty and you are providing either nothing or some value which is not int for @.qty.

First, make sure that the value in your textbox TextBox1 in of type int.

Second, for better confirmation, pass the cast(ed) value to the @.qty parameter, like Convert.ToInt32(TextBox1.text). This way you'll immediately get notified on the line where you try to convert it to int if the textbox is holding non int values.

jbear123:

command.CommandText = "INSERT INTO Transactions (Usersname,Itemid,itemname,Date,Qty) VALUES ('@.User','@.productID','@.Itemsname',@.date,'@.qty')";

I don't know whether this line is being executed or not, but anyway you'll get an error if at all this line gets executed. The problem is in the insert query you've written. You don't need to add ' (single quotation) around the parameters. It is required only if you're passing the values directly in the query.

Hope this will help.

|||

Hi,

dhimant:

First, make sure that the value in your textbox TextBox1 in of type int.

Just make sure the value typed in is int? Or do i have to edit the settings to make the textbox int only?

The value typed in is always int..

dhimant:

Second, for better confirmation, pass the cast(ed) value to the @.qty parameter, like Convert.ToInt32(TextBox1.text). This way you'll immediately get notified on the line where you try to convert it to int if the textbox is holding non int values.


Where should I put the Convert.ToInt32(TextBox1.text) code?

dhimant:

I don't know whether this line is being executed or not, but anyway you'll get an error if at all this line gets executed. The problem is in the insert query you've written. You don't need to add ' (single quotation) around the parameters. It is required only if you're passing the values directly in the query.


Thanks! Done!

Thanks alot,

Jon

|||

jbear123:

Where should I put the Convert.ToInt32(TextBox1.text) co

Just where you're setting the value for the command parameter value. Instead of just TetBox1.Text write Convert.ToInt32(TextBox1.Text).

|||

Hi,

I had tried that it gives me the same error:

System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value '@.qty' to data type int.

..?

Cheers,

Jon

|||

Now, can you re-post the all modified code again ? I don't see any problem if you've made all the correction. One more thing, Why are you using both button2_command and click events and what are you trying to do with them ?

|||

Hi,

Code:

private bool ExecuteUpdate(int quantity)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True";

con.Open();

SqlCommand command = new SqlCommand();
command.Connection = con;
TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");
Label labname = (Label)FormView1.FindControl("Label3");
Label labid = (Label)FormView1.FindControl("Label13");

command.CommandText = "UPDATE Items SET Quantityavailable = Quantityavailable - '@.qty' WHERE productID=@.productID";
command.Parameters.Add("@.qty", TextBox1.Text);
command.Parameters.Add("@.productID", labid.Text);
command.ExecuteNonQuery();

con.Close();
return true;
}

private bool ExecuteInsert(String quantity)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True";

con.Open();

SqlCommand command = new SqlCommand();
command.Connection = con;
TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");
Label labname = (Label)FormView1.FindControl("Label3");
Label labid = (Label)FormView1.FindControl("Label13");

command.CommandText = "INSERT INTO Transactions (Usersname,Itemid,itemname,Date,Qty) VALUES (@.User,@.productID,@.Itemsname,@.date,@.qty)";
command.Parameters.Add("@.User", System.Web.HttpContext.Current.User.Identity.Name);
command.Parameters.Add("@.Itemsname", labname.Text);
command.Parameters.Add("@.productID", labid.Text);
command.Parameters.Add("@.qty", Convert.ToInt32(TextBox1.Text));
command.Parameters.Add("@.date", DateTime.Now.ToString());
command.ExecuteNonQuery();

con.Close();
return true;
}

protected void Button2_Click(object sender, EventArgs e)
{
TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;
ExecuteUpdate(Int32.Parse(TextBox1.Text) );
}

protected void Button2_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "Update")
{
TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;
ExecuteInsert(TextBox1.Text);
}
}
}

dhimant:

One more thing, Why are you using both button2_command and click events and what are you trying to do with them ?

I used them to initiate update and insert, someone suggested that I didnt put them both in button click? Should I?

Thanks again!

Jon