Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Crosstab

Author  Topic 

malen
Starting Member

2 Posts

Posted - 2009-02-25 : 04:18:46
I have downloaded the crosstab and it is working but when i called the procedure in asp.net 2.0, it returns the error incorrect near the work END, Below is my script in asp.net


SqlCommand command = new SqlCommand("Crosstab", Conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@Select", SqlDbType.VarChar);
command.Parameters.Add("@sumfunc", SqlDbType.VarChar);
command.Parameters.Add("@pivot", SqlDbType.VarChar);
command.Parameters.Add("@table", SqlDbType.VarChar);

command.Parameters["@Select"].Value = "Select ESN FROM DataEntry INNER JOIN Component ON (DataEntry.ComponentCode = Component.ComponentCode ) GROUP By ESN ";

command.Parameters["@sumfunc"].Value = "count(DataEntry.ComponentCode)";
command.Parameters["@pivot"].Value = "SAPComponentDesc";
command.Parameters["@table"].Value = "Component";
SqlDataReader reader = command.ExecuteReader();
DataTable dtab = new DataTable();
dtab.Load(reader);

GridView1.DataSource = command.ExecuteReader();
GridView1.DataBind();


Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-25 : 09:42:08
did you try running it in query analyser and see if it worked?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2009-02-25 : 09:46:42
moved from Script Library forum

___________________________________________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.5 out!
Go to Top of Page

malen
Starting Member

2 Posts

Posted - 2009-02-25 : 19:38:04
Yes it is working in query analyzer...


quote:
Originally posted by visakh16

did you try running it in query analyser and see if it worked?

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-02 : 05:05:12
Post the code for crosstab

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -