Datagrid: Vertical Rows instead of Horizontal Rows
Hi,
Usually, inside a datagrid there are rows and columns.
The rows shows ex. one product for each line. Each product has some properties like number, color, weight,...
What we wanted to do is not to show one product per line, but 1 product per column: --> see the example
Normal Datagrid:
Number Description Color Weight ...
1 Product 1 red 10 kg
2 Product 2 green 15 kg
3 Product 3 blue 5 kg
What we want is:
Number 1 2 3
Description Product 1 Product 2 Product 3
Color red green blue
Weight 10 kg 15 kg 5 kg
Possible to do with standard Flex SDK?
Did anyone write such a component already with Flex 3 or Flex 4?
Thanks for any help on that issue.
A pivot table is something else...
To change the datasource is possible, but the result is not what is correct.
cause:
- The selection of one product must be a vertical selection, and not a horizontal one.
- The column header must be at the left side, and not at the top!
But yes, sure, everything is possible to develop....
thanks anyway :-)
Similar Messages
-
Query result area on the first row instead of last row
Hi BI experts,
I want to display the result of the BI query at the first row instead of last row.Could somebody help me how to accomplish this.
I tried with the layout->move result area but could not be possible.
I need your kind suggetion.
Thanks.hi jyuoti,
Further, open your query in query designer, look at the query property, under the tab "rows/columns"
change the result position of rows to "Below", you can see the preview there itself.
This should solve your problem.
Best Regards,
*Assign points if you find the answer useful. -
Producedure givng two rows instead of one row
Hi
Please find below my procedure..when I execute this proc...displays two rows instead of one row. Please help me incase if I did mistake.
CREATE PROCEDURE SP_CWCTravel_Cruise_Amenities_S(
@Cruise_Line_Code varchar(2500) = NULL,
@Ship_Code varchar(2500) = NULL,
@Sail_Id varchar(100) = NULL,
@Base_Price decimal(8, 2),
@Category_Groups varchar(2500) = NULL,
@Categories varchar(2500) = NULL,
@Rate_Codes varchar(2500) = NULL,
@Booking_Date VARCHAR( 10 ),
@Sail_Start_Date VARCHAR( 10 )
AS
BEGIN
SELECT TOP 1 *
FROM CWCTravel_Cruise_Amenities_Definition as cad
JOIN CWCTravel_Cruise_Amenities_Definition_Date_Range AS caddr
ON cad.id = caddr.Amenities_Definition_Id
WHERE Cruise_Line_Code in (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Cruise_Line_Code))
AND (Min_Base_Price = 0 OR Min_Base_Price <= @Base_Price)
AND (Max_Base_Price = 0 OR Max_Base_Price >= @Base_Price)
AND (Ship_Code IS NULL OR Ship_Code = '' OR Ship_Code IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Ship_Code)))
AND (Sail_Id IS NULL OR Sail_Id = '' OR Sail_Id IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Sail_Id)))
AND (Rate_Codes IS NULL OR Rate_Codes = '' OR ((SELECT COUNT(*) FROM
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Rate_Codes)) A,
(SELECT REPLACE(REPLACE(Item,'?', '_'), '*', '%') Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Rate_Codes)) B
WHERE A.Item LIKE B.Item) > 0))
AND (Category_Groups IS NULL OR Category_Groups = '' OR ((SELECT COUNT(*) FROM
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Category_Groups)) A,
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Category_Groups)) B
WHERE A.Item LIKE B.Item) > 0))
AND (Categories IS NULL OR Categories = '' OR ((SELECT COUNT(*) FROM
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Categories)) A,
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Categories)) B
WHERE A.Item LIKE B.Item) > 0))
AND (@Booking_Date is null or @Booking_Date=''
OR (( caddr.from_date IS NULL OR caddr.from_date <= @Booking_Date ) AND ( caddr.to_date IS NULL OR caddr.to_date >= @Booking_Date )
AND (( caddr.date_range_type IS NULL ) OR ( caddr.date_range_type = 'BOOK_DATE' ))) )
union
SELECT TOP 1 *
FROM CWCTravel_Cruise_Amenities_Definition as cad
JOIN CWCTravel_Cruise_Amenities_Definition_Date_Range AS caddr
ON cad.id = caddr.Amenities_Definition_Id
WHERE Cruise_Line_Code in (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Cruise_Line_Code))
AND (Min_Base_Price = 0 OR Min_Base_Price <= @Base_Price)
AND (Max_Base_Price = 0 OR Max_Base_Price >= @Base_Price)
AND (Ship_Code IS NULL OR Ship_Code = '' OR Ship_Code IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Ship_Code)))
AND (Sail_Id IS NULL OR Sail_Id = '' OR Sail_Id IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Sail_Id)))
AND (Rate_Codes IS NULL OR Rate_Codes = '' OR ((SELECT COUNT(*) FROM
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Rate_Codes)) A,
(SELECT REPLACE(REPLACE(Item,'?', '_'), '*', '%') Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Rate_Codes)) B
WHERE A.Item LIKE B.Item) > 0))
AND (Category_Groups IS NULL OR Category_Groups = '' OR ((SELECT COUNT(*) FROM
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Category_Groups)) A,
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Category_Groups)) B
WHERE A.Item LIKE B.Item) > 0))
AND (Categories IS NULL OR Categories = '' OR ((SELECT COUNT(*) FROM
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Categories)) A,
(SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Categories)) B
WHERE A.Item LIKE B.Item) > 0))
AND (@Sail_Start_Date is null or @Sail_Start_Date=''
OR (( caddr.from_date IS NULL OR caddr.from_date <= @Sail_Start_Date ) AND ( caddr.to_date IS NULL OR caddr.to_date >= @Sail_Start_Date )
AND (( caddr.date_range_type IS NULL ) OR ( caddr.date_range_type = 'TRAVEL_DATE' ))) )
ORDER BY Cruise_Line_Code DESC, Ship_Code DESC, Sail_Id DESC, Rate_Codes DESC, Category_Groups DESC, Categories DESC
ENDWhile executing this SP
I am getting the following results.
2043 23-07-2010 AM 11:22:10 23-08-2011 PM 04:57:19 8 princess caribbeanPrincess 2043 20-08-2011 AM 12:00:00 30-11-2011 AM 12:00:00 BOOK_DATE
2043 23-07-2010 AM 11:22:10 23-08-2011 PM 04:57:19 8 princess caribbeanPrincess 2043 01-10-2011 AM 12:00:00 30-11-2011 AM 12:00:00 TRAVEL_DATE
I need only the first record.
Thanks in adv
Rekha871270 wrote:
Hi
Please find below my procedure..when I execute this proc...displays two rows instead of one row. Please help me incase if I did mistake.Seriously?
You wrote a query against tables we've never seen, containing data we can't possibly have any idea about and you expect us to be able to help you?
Please go discuss this with someone in your organization who understands the data model and have them explain to you how it is supposed to work.
Put yourself in our situation (forum volunteers) ... if we threw some arbitrary code with no explanation as to what it does, what the data model looks like and what's supposed to be happening, do you think you'd be very successful ? -
Showing report data columns into two rows instead of one row using SSRS 2012
Hi All,
I have a ssrs report with 13 columns and I want to show those 13 columns data into two rows instead of showing in one row. please send me step by step process.
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
1 ABC A C
xyz xyz123 york
PA 12345
homephone cellphone workphone company
1234567890 4567890123 0123456789 ABC,Inc
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
2 XYZ X Z
abc abc123 lewisburg
PA 54321
homephone cellphone workphone company
4567890123 0123456789 1234567890 xyz,Inc
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
3 BCD B D
123abc xyz123 leesburg PA
54123
homephone cellphone workphone company
4567895623 0783456789 1238967890 Hey,Inc
Thanks in advance,
RH
sqlDo a right mouse click on the left, gray row marker => "Insert Row"=> "Inside Group
- Above or Below", then you get a second detail row.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Spry menu bar - vertical format instead of horizontal
When I inserted the Spry Menu Bar I selected a Horizontal format (instead of Vertical). However, the menu bar appears vertically in the document. I have inserted it on top of the banner (which was inserted as a background image within a table) and is definitely wide enough to accommodate a horizontal menu bar. I have deleted it and tried a couple of times but still the horizontal selection appears in a vertical format. Any ideas much appreciated.
This is how it appears in code:
<table width="970" border="0">
<tr>
<td height="160" class="banner"><ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="#">Item 1</a> </li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a> </li>
<li><a href="#">Item 4</a></li>
<li><a href="#">Untitled Item</a></li>
</ul></td>
</tr>
</table>Make sure that you have saved the Spry Assets that go along with the Menubar. I assume that you have, but this menubar is a simple list without its assets.
Also make sure that you have not inadvertently indicated the Vertical menubar. I assume that you have not.
When you delete and re-insert a Spry Widget, make sure that you do it by clicking anywhere in the Widget on the Document Window and then clicking on the blue widget tab. Then press delete, and all evidence of the Widget will go from your page. I find that manually editing does not always 'clean up' after disabling a Widget.
If you can post the page live somewhere, we can give you a better answer.
Z -
Result in same row instead of two rows
I have to select same field on two different condition ie.
select
(case when data_type_id = 1 then hrscycles else 0 end) totalhours
,(case when data_type_id = 10 then hrscycles else 0 end) totalcycles
from mytable
Problem is query is returning 2 rows whereas i want result in single row.Is there any other solution?select (case when data_type_id = 1 then hrscycles else 0 end) totalhours,
(case when data_type_id = 10 then hrscycles else 0 end) totalcycles
from mytableyour query in the above will return two columns and will return multiple rows depending on the data your table have.
maybe you want single column?
select (case when data_type_id = 1 then hrscycles
else 0
end) attribute1
from mytable
union all
select (case when data_type_id = 10 then hrscycles
else 0
end) attribute1
from mytableor if you want a multiple rows into a single column:
SQL> select * from pivot_tab;
COL1 COL2
1 a
1 b
1 c
2 h
2 h
SQL> select p.col1,
2 substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
3 as col2
4 from (select col1,
5 col2,
6 row_number() over (partition by col1 order by col1, col2) rn
7 from pivot_tab) p
8 start with p.rn = 1
9 connect by p.rn = prior p.rn + 1
10 and prior p.col1 = p.col1
11 group by col1;
COL1 COL2
1 a,b,c
2 h,h
SQL> -
Missing rows / output only one row in a Report after applying patchset 2
Hi.
We use Reports Builder for 10g R2. We had the problem with our AS 10g R2 on windows 2003, that some reports creates duplicate rows when it is a ASCII report (desformat = delimited), see Bug 3340546.
Now we apply Patchset 2 on a local machine, to test the functionality. It fix the problem (look in metalink doc ID 398955.1 under "2.12 Oracle Reports Developer Bugs")-
But now most csv reports creates only one row instead of multiple rows.
We run reports on our local machine with OC4N and local started Form (via Forms Builder) to generate the reports (local started report server) from DevSuite).
When we start the reports with desformat=delimited the txt-file has only the header row and one data row (instead of multiple ones).
And when we generate the same report with desformat=delimiteddata it looks fine and generates all rows as expected.
We found neither here in the forum or in metalink knowledge base nor on the internet.
Have you any suggestions for us how to fix this problem?
Using delimiteddata is now acceptable solution for us, because delimited is easier to use.
Thanks for your help!Hey folks.
We have solved the problem. :)
We applied PatchSet2 for 10gR2. But we don´t know how the csv-report outputs only 1 data-row instead of several rows.
Than we create a similar report (with the same sql-query) as a new one with the reports builder assistant.
This one works pretty fine. So we looked for the attributes and see the "max. number datasets for each site" and it was in the new one set to 0 and in our old one set to 1.
So we change this and ... the old one works pretty fine! :)
So the problem is, that this attribute does not had any consequences in the old version. But since we update with PatchSet 2 it respect this attribute but we don´t "see" it.
Hope this helps others. -
Urgent SQL question : how to flip vertical row values to horizontal ?
Hello, Oracle people !
I have an urgent SQL question : (simple for you)
using SELECT statement, how to convert vertical row values to horizontal ?
For example :
(Given result-set)
MANAGER COLUMN1 COLUMN2 COLUMN3
K. Smith ......1
K. Smith ...............1
K. Smith ........................1
(Needed result-set)
MANAGER COLUMN1 COLUMN2 COLUMN3
K. Smith ......1 .......1 .......1
I know you can, just don't remeber how and can't find exactly answer I'm looking for. Probably using some analytic SQL function (CAST OVER, PARTITION BY, etc.)
Please Help !!!
Thanx !
Steve.scott@ORA92> column vice_president format a30
scott@ORA92> SELECT f.VICE_PRESIDENT, A.DAYS_5, B.DAYS_10, C.DAYS_20, D.DAYS_30, E.DAYS_40
2 FROM (select t2.*,
3 row_number () over
4 (partition by vice_president
5 order by days_5, days_10, days_20, days_30, days_40) rn
6 from t2) f,
7 (SELECT T2.*,
8 row_number () over (partition by vice_president order by days_5) RN
9 FROM T2 WHERE DAYS_5 IS NOT NULL) A,
10 (SELECT T2.*,
11 row_number () over (partition by vice_president order by days_10) RN
12 FROM T2 WHERE DAYS_10 IS NOT NULL) B,
13 (SELECT T2.*,
14 row_number () over (partition by vice_president order by days_20) RN
15 FROM T2 WHERE DAYS_20 IS NOT NULL) C,
16 (SELECT T2.*,
17 row_number () over (partition by vice_president order by days_30) RN
18 FROM T2 WHERE DAYS_30 IS NOT NULL) D,
19 (SELECT T2.*,
20 row_number () over (partition by vice_president order by days_40) RN
21 FROM T2 WHERE DAYS_40 IS NOT NULL) E
22 WHERE f.VICE_PRESIDENT = A.VICE_PRESIDENT (+)
23 AND f.VICE_PRESIDENT = B.VICE_PRESIDENT (+)
24 AND f.VICE_PRESIDENT = C.VICE_PRESIDENT (+)
25 AND f.VICE_PRESIDENT = D.VICE_PRESIDENT (+)
26 AND f.VICE_PRESIDENT = E.VICE_PRESIDENT (+)
27 AND f.RN = A.RN (+)
28 AND f.RN = B.RN (+)
29 AND f.RN = C.RN (+)
30 AND f.RN = D.RN (+)
31 AND f.RN = E.RN (+)
32 and (a.days_5 is not null
33 or b.days_10 is not null
34 or c.days_20 is not null
35 or d.days_30 is not null
36 or e.days_40 is not null)
37 /
VICE_PRESIDENT DAYS_5 DAYS_10 DAYS_20 DAYS_30 DAYS_40
Fedele Mark 35473 35209
Fedele Mark 35479 35258
Schultz Christine 35700
South John 35253
Stack Kevin 35701 35604 35402 35115
Stack Kevin 35705 35635 35415 35156
Stack Kevin 35706 35642 35472 35295
Stack Kevin 35707 35666 35477
Stack Kevin 35667 35480
Stack Kevin 35686
Unknown 35817 35698 35596 35363 35006
Unknown 35702 35597 35365 35149
Unknown 35724 35599 35370 35155
Unknown 35600 35413 35344
Unknown 35601 35451 35345
Unknown 35602 35467
Unknown 35603 35468
Unknown 35607 35475
Unknown 35643 35508
Unknown 35644
Unknown 35669
Unknown 35684
Walmsley Brian 35725 35598
23 rows selected. -
How do you set the number of rows you want in a spreadsheet, so that even when you drag data in, in writes over those rows instead of adding a new row?
After the discovery reported above, I filed this report :
Bug ID# 10073038
Summary:
When Numbers is used on a system with decimal comma a csv file may be good AND wrong
Steps to Reproduce:
With Numbers v2, you introduced an interesting enhancement.
In system using the comma as decimal separator, Numbers requires csv files using the semi-colon as values delimiter.
In fact it’s true if we OPEN the document dragging its icon on Numbers one or thru the open dialog.
This said.
(1) Drag and drop a csv built with the 'semi-colon' standard on a table or on a sheet
(2) Drag and drop a csv built with the 'comma' standard on a table or on a sheet
Expected Results:
Every normally constituted user assume that in
case (1) he will get a perfectly built table
case (2) he will get every cells of a row in a single cell
Actual Results:
In fact you forgot the drag and drop way of use and in
case (1) every values separated by semi-colon are inserted in a single cell
case (2) values separated by comma are correctly spread in a table
isn’t it ridiculous ?
Regression:
Except looking in QuickView to see which is exactly the structure of the file to decide the way we will insert it in a Numbers document, we may use an applescript fair enough to replace the semi-colons by TAB characters
or
to replace the commas by TABs and the decimal periods by commas
Notes:
While I am on this subject, I wish to make two proposals:
(1) It would be fine to format the date according to the ISO format year-mm-dd when you export a Numbers doc to csv.
Doing that, dates would be imported correctly in every countries.
At this time, on an English system, you export as mm/dd/year.
If the doc is open on a system using the format dd/mm/year, the results will be odd.
On a system using the format dd/mm/year, you export this way and so, if the doc is open on a system using the format mm/dd/year the results are odd too.
As every localized versions accept the ISO format (at least on entry), using it in the export scheme would give a correct behavior everywhere.
(2) It would be fine to add the format Tab Separated Values in the Export pane.
TSV + ISO date format would give documents opening flawlessly everywhere.
Yvan KOENIG (VALLAURIS, France) dimanche 4 septembre 2011 21:27:41
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community -
How can i select the next column instead of next row when press enter key
I need to know how can i select the next column instead of next row when i press the enter key.By default ,when i press enter key the next row is selected and the column remain unchanged but I wants opposite that is the row should remain unchanged but column index will changed.
Thanks to all.Well, the right arrow key will already move you to the next column, so the easiest way to do this is to modify the InputMap to have the Enter key invoke the same Action as the right arrow key.
You can search the forum for my "Table Actions" (without the space) example that will show you how to do this. -
I am using coldfusion to query an oracle table....Query returns approximately 2000 rows, however the max rows the datagrid will display is 1000. Does anybody know how to change this...THANKS!!
Thanks so much for your answer that sounds like a good idea...
I found the answer to my initial problem...In my coldfusion I had set maxrows = 1000. So the datagrid was always returning 1000 records even when a lot more than that should have been returned...When I removed the maxrows parameter in the coldfusion code, my datagrid was now been populated with the correct number of rows...
thanks again for your help,
Ronnie Raigrodski (Aka -- FlexNerd) -
How to display ID and Type in a row instead of column
I have a table A with ID_NO, TYPE, PUBID(foreign key).
The type can be CAT, ISBN, ISSN. I also have another table B with PUB_ID (primary key) and a lot of other details.
The requirements are to display the results as rows like this:
PUB_NO | CAT | ISBN | ISSN
222 | abc | qwe | zxc
I know it would be easy to display like this:
ID_NO | TYPE | PUB_NO
abc | CAT | 222
qwe | ISBN | 222
zxc | ISSN | 222
But I need it in a row instead. I was thinking of getting all PUB_NOs and looping through each to get the rest in a PL/SQL procedure but is this the best approach?
I can't wrap my head around this. I'm not a DB expert and I haven't done any PL/SQL in a very long time.
Thanks for your help
MarcelJohn:
<quote>
I did point out the need for unique types in my original post with the MAX/DECODE solution.
</quote>
Indeed, you did. Sorry about that ... I looked closely only at your last post with the two SQLs and missed the caveat you had included in the first post.
:o) ... couldn't stop myself ... one last loose [but reasonable?!?!] thing [I can think of] to keep those 2 sql different:
insert into pubDetail values (333,'333');
â¦
flip@FLOP> select * from pubDetail;
Â
PUB_NO PUB_DATA
111 111
222 222
333 333
Â
flip@FLOP> select * from test_a;
Â
ID_NO TYPE PUB_NO
abc CAT 111
def CAT 222
qwe ISBN 111
xyz ISSN 222
Â
flip@FLOP> SELECT d.pub_no, a.cat, b.isbn, c.issn
2 FROM pubDetail d,
3 (SELECT pub_no, id_no cat
4 FROM test_a
5 WHERE type = 'CAT') a,
6 (SELECT pub_no, id_no isbn
7 FROM test_a
8 WHERE type = 'ISBN') b,
9 (SELECT pub_no, id_no issn
10 FROM test_a
11 WHERE type = 'ISSN') c
12 WHERE d.pub_no = a.pub_no(+) AND
13 d.pub_no = b.pub_no(+) AND
14 d.pub_no = c.pub_no(+)
15 ;
Â
PUB_NO CAT ISBN ISSN
111 abc qwe
222 def xyz
333
Â
flip@FLOP> SELECT d.pub_no
2 ,MAX(DECODE(a.type, 'CAT' , id_no)) cat
3 ,MAX(DECODE(a.type, 'ISBN', id_no)) isbn
4 ,MAX(DECODE(a.type, 'ISSN', id_no)) issn
5 FROM pubDetail d, test_a a
6 WHERE d.pub_no = a.pub_no
7 AND a.type IN ('CAT', 'ISBN', 'ISSN')
8 GROUP BY d.pub_no
9 ;
Â
PUB_NO CAT ISBN ISSN
111 abc qwe
222 def xyzHope you take this only as a bit of humor [about incomplete requirements] ⦠I like your stuff! -
Update statement inserts a new row instead of updating
My code should just update a single specific row in the table. I used a simple procedure to update a record in the current application as well and it runs without any problem except this case. Every time the query runs, it actually inserts a new row instead
of just updating an existing:
So here is my c# code:
try
command.Parameters.Clear();
command.Parameters.AddRange(vars);
command.CommandText = "Update" + tableName;
conn.Open();
command.ExecuteNonQuery();
conn.Close();
this.GetData(tableName);
catch
throw;
And here is my SQL code (please ingore 'Alter Procedure' statement, I just wanted to get the core script of the procedure):
ALTER procedure [dbo].[UpdateExpenditureItems]
(@ID int,
@Name nvarchar(50),
@IsGroup bit,
@Parent nvarchar(50),
@Description nvarchar(50)
AS
Begin
--a new inserted row seems to be a result of running IF statement rather than ELSE
if @Parent is not null
begin
declare @ParentID int
set @ParentID = (select ID from ExpenditureItems where Name=@Parent);
UPDATE ExpenditureItems SET Name =@Name, Parent =@ParentID, [Description] =@Description, IsGroup = @IsGroup WHERE ID=@ID;
end
else
begin
UPDATE ExpenditureItems SET Name =@Name, [Description] =@Description WHERE ID=@ID
end
end
I ran the query itself from sql management studio and it works fine. The problem seems to be in c# code, but there's nothing unusual. Same code for operations with the databse works fine in other parts of the software... I appreciate your help!
Thanks in advance!Please can you post your full C# code for this function? Also the code you sent is not calling an SP? so why do we need to validate against the SP?
Fouad Roumieh
So here is my code:
//Update is called on OK button click
private void okBut_Click(object sender, EventArgs e)
//edit code runs here
SqlParameter[] pars = new SqlParameter[5];
pars[0] = new SqlParameter("@ID", int.Parse(idTB.Text));
pars[0].SqlDbType = SqlDbType.Int;
pars[1] = new SqlParameter("@Name", itemTB.Text);
pars[1].SqlDbType = SqlDbType.NVarChar;
pars[2] = new SqlParameter("@IsGroup", true);
pars[2].SqlDbType = SqlDbType.Bit;
pars[3] = new SqlParameter("@Parent", DBNull.Value);
pars[3].SqlDbType = SqlDbType.Int;
pars[4] = new SqlParameter("@Description", descTB.Text);
pars[4].SqlDbType = SqlDbType.NVarChar;
try
DAL dal = new DAL();
dal.UpdateData("ExpenditureItems", pars); //Update is called here
catch (Exception ex)
StaticValues.WriteEventLogXML(ex, this.Text);
switch (StaticValues.user.Language)
case "English":
MessageBox.Show("Database error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
default:
break;
finally
this.DialogResult = System.Windows.Forms.DialogResult.OK;
StaticValues.currentNode = itemTB.Text;
public void UpdateData(string tableNameString, SqlParameter[] vars)
string tableName = tableNameString.Replace(" ", string.Empty);
try
command.Parameters.Clear();
command.Parameters.AddRange(vars);
command.CommandText = "Update" + tableName;
conn.Open();
command.ExecuteNonQuery();
conn.Close();
this.GetData(tableName);
catch
throw;
And here is GetData procedure:
public void GetData(string tableNameString)
string tableName = tableNameString.Replace(" ", string.Empty);
command.CommandText = "Get" + tableName;
command.Parameters.Clear();
if (!StaticValues.dataSet.Tables.Contains(tableName))
StaticValues.dataSet.Tables.Add(tableName);
else
StaticValues.dataSet.Tables[tableName].Clear();
try
adapter.SelectCommand = command;
conn.ConnectionString = DAL.ConnectionString;
command.Connection = conn;
conn.Open();
adapter.Fill(StaticValues.dataSet.Tables[tableName]);
conn.Close();
catch
throw;
And this is my complete code for sql procedure:
USE [ISWM project]
GO
/****** Object: StoredProcedure [dbo].[UpdateExpenditureItems] Script Date: 13.04.2015 9:09:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[UpdateExpenditureItems]
(@ID int,
@Name nvarchar(50),
@Parent nvarchar(50),
@Description nvarchar(50),
@IsGroup bit
AS
Begin
if @Parent IS NOT null
begin
declare @ParentID int
set @ParentID = (select ID from ExpenditureItems where Name=@Parent);
UPDATE ExpenditureItems SET Name =@Name, Parent =@ParentID, [Description] =@Description, IsGroup = @IsGroup WHERE ID=@ID;
end
else
begin
UPDATE ExpenditureItems SET Name =@Name, [Description] =@Description WHERE ID=@ID
end
end
The codes posted above work great in other similar parts of the application where select, insert, delete and update is required.
Concerning my current problem - I ran the procedure itself in SQL Server Management Studio, and it works well. I would say that there's something wrong with my c# code, but it can't be wrong because it's quite simple and works in other place in my application...
I really don't get what's missing... -
Financial Reporting Charts and Legend in horizontal row
Hi all,
In the knowledge browser there is a "how to" enchancement on how to show legend in one horizontal row ([ID 794882.1]).
In a few words, the solution was to edit the resulting XML file (*.des) as follows:
A. Search for the string "OTHERPROPERTIES" with no quotes.
B. Make the following change: OTHERPROPERTIES="LegendLayout=(HORIZONTAL,BOTTOM,,,,)"
However, now our need is to have charts with decimals which requires to open the *.DES file in a text editor and add the following parameter after OBJECT_WIDTH: OTHERPROPERTIES="LeftFormat=(FLOAT, '%8.1f')"
My question is how to have both Otherproperties expressions in one chart. I would be grateful if anyone could tell me how to have both Otherproperties in one chart since I don't have a lot of experience in XML.
Thank you in advance,
ThanasisHi all,
The answer was simple... OTHERPROPERTIES="LeftFormat=(FLOAT, '%8.1f');LegendLayout=(HORIZONTAL,BOTTOM,,,,)" -
How to show PieChart Vertically instead of Horizontally?
Hi,
Like the title indicates, I hope that is there property or
method or event allowing to show a PieChart Vertically instead of
horizontally.
Cheers,for example :
my pie chart represents two values : 50% and 50%. How this
values will be shown in PieChart? the answer is vertically the
first 50% in the top and the second one in the bottom.
What I want is to show the values horizontally that's mean in
this example the first 50% in the right and the other one in the
left.
Thank you in advance :)
Maybe you are looking for
-
I deleted random bands and certain songs that I no longer wish to have on my iTunes or my iPod. So, they're all off of my iTunes, but still on my iPod. How do I delete only the items on my iPod that are no longer on my iTunes? Is there a way to sync
-
Interview questions and answers on Dashboards
Hi Experts, Anyone suggest me the interview questions with answers on Dashboards. Thanks Anusha.P
-
Hi, I have created form with report.i want to apply the function like initcap,upper or lower apply changes portion of item. e.g when i click on pencil image to modify the value.item which holds the value.if i enter value in lower case.i want to make
-
How to find the concurrent user licenses usuage
Hi, Can you someone tell me how to find the concurrent user licenses usage. if i go to CM C -> Settings -> View Global System Metrics then it is showing strange number in the area of peak licenses used since deployment (more than 5K), Is there is an
-
Trial question: Can't open .doc files from web page
I'm using Dreamweaver on a Mac, and I have a link on a page that should bring up a doc file. When I preview the page in Safari, it brings up a directory listing which highlights the file so that you can double-click and open the file. (Of course, I'd