Showing posts with label details. Show all posts
Showing posts with label details. Show all posts

Friday, March 30, 2012

parameter passing problem


why this wont work?

error:
Exception Details: System.Data.SqlClient.SqlException: Procedure or Function 'test1' expects parameter '@.cid', which was not supplied.

.............................................................
ASPX CODE:
string cid12;
cid12 = "user5";
// Connection
ConnectionStringSettings mysettings;
mysettings = System.Configuration.ConfigurationManager.ConnectionStrings["dbase1_connection"];
string myConnectionString = mysettings.ConnectionString;
SqlConnection conn1 = new SqlConnection(myConnectionString);

SqlCommand cmd = new SqlCommand();
cmd.Connection = conn1;
cmd.CommandText = "test1";
cmd.CommandType = CommandType.StoredProcedure;

SqlParameter param = cmd.Parameters.Add("@.cid", SqlDbType.NChar, 20);
param.Direction = ParameterDirection.Input;
param.Value = cid12;

conn1.Open();
cmd.ExecuteNonQuery();
conn1.Close();
.............................................................

STORED PROCEDURE:
ALTER PROCEDURE dbo.test1
(
@.cid nvarchar(20)
)
AS
/* SET NOCOUNT ON */
select tech_id, customer_id, issue_main from [case] where customer_id = @.cid
--GO
RETURN

.............................................................

im using asp.net, C#, and sql express
forgive me. im new to this .net
PLS HELP

pls ignore the post above. i found out that nothing is wrong with that code. i discovered that one on my grid view tables is causing the issue and it is indeed not passing a parameter and thats the reason why i have wasted 12hrs looking at my monitor. hehehe.

my fault. im just human. forgive me.

thanks to you all.

parameter passing problem


why this wont work?
error:
Exception Details: System.Data.SqlClient.SqlException: Procedure or Function 'test1' expects parameter '@.cid', which was not supplied.
.................................................................................
ASPX CODE:
string cid12;
cid12 = "user5";
// Connection
ConnectionStringSettings mysettings;
mysettings = System.Configuration.ConfigurationManager.ConnectionStrings["dbase1_connection"];
string myConnectionString = mysettings.ConnectionString;
SqlConnection conn1 = new SqlConnection(myConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn1;
cmd.CommandText = "test1";
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter param = cmd.Parameters.Add("@.cid", SqlDbType.NChar, 20);
param.Direction = ParameterDirection.Input;
param.Value = cid12;

conn1.Open();
cmd.ExecuteNonQuery();
conn1.Close();
.................................................................................
STORED PROCEDURE:
ALTER PROCEDURE dbo.test1
(
@.cid nvarchar(20)
)
AS
/* SET NOCOUNT ON */
select tech_id, customer_id, issue_main from [case] where customer_id = @.cid
--GO
RETURN
.................................................................................
im using asp.net, C#, and sql express
forgive me. im new to this .net
PLS HELP

forgive me. i found out that the codes above are just ok. i found out that one of my grid table is the one causing the problem - it is not passing a parameter. hehehe. my fault. im just human.

thanks to you all.

Wednesday, March 7, 2012

pagenumber in body

Headers are more sophistacated these days. They require client information,
report execution date, page number, report spacific details like account
numbers.
It seems that I cannot put a pagenumber in the body, and I cannot have
dataset info in the header. If I wanted to do this ... could I ? I would
like a 'Power Header' with a mix of global variables like pagenumber mixed
with dataset fields... Can this be done?You this special case you could refer the dataSource on some reportItems
rather than the fields collection.
HTH; Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"d pak" <dipakb@.exchnage.ml.com> schrieb im Newsbeitrag
news:B80D6CE0-CCA3-481C-B1CA-580642863773@.microsoft.com...
> Headers are more sophistacated these days. They require client
> information,
> report execution date, page number, report spacific details like account
> numbers.
> It seems that I cannot put a pagenumber in the body, and I cannot have
> dataset info in the header. If I wanted to do this ... could I ? I would
> like a 'Power Header' with a mix of global variables like pagenumber mixed
> with dataset fields... Can this be done?

Saturday, February 25, 2012

PageBreak after x items for group, different on first page

I am trying to add a page break for table details after x items with x being different for the first page of report.

I am able to add a page break by adding a group to table with group expression =Int((RowNumber(Nothing)-1)/25). But I can't figure out how to do this where groupexpression on page 1 of report = Int((RowNumber(Nothing)-1)/15) and on all other pages =Int((RowNumber(Nothing)-1)/25).

I tried

=IIF(Globals!PageNumber=1,Int((RowNumber(Nothing)-1)/15),Int((RowNumber(Nothing)-1)/25))

but Globals cannot be used in group expression. I also tried putting group expression in a textbox on the report but it will not let me refer to the textbox.

Any assistance is appreciated!
Chris

references: http://msdn2.microsoft.com/en-us/library/ms157328.aspx , http://msdn2.microsoft.com/en-us/library/ms157328(en-US,SQL.90).aspx

Try a group expression like this:

=iif(RowNumber(Nothing) <= 15, Int((RowNumber(Nothing)-1)/15), Int((RowNumber(Nothing)-1-15)/25))

This should result in 15 rows for the first page, and 25 rows on subsequent pages.

-- Robert