Click here to Skip to main content
15,907,874 members
Home / Discussions / C#
   

C#

 
Generalusing directive Pin
andrewpritchie24-Jul-05 3:40
andrewpritchie24-Jul-05 3:40 
GeneralRe: using directive Pin
DavidNohejl24-Jul-05 4:31
DavidNohejl24-Jul-05 4:31 
GeneralRe: using directive Pin
Dave Kreskowiak24-Jul-05 4:37
mveDave Kreskowiak24-Jul-05 4:37 
QuestionOutlook 2003 Add-In with C#? Pin
fcn][Stampede24-Jul-05 2:07
fcn][Stampede24-Jul-05 2:07 
AnswerRe: Outlook 2003 Add-In with C#? Pin
Brian Delahunty24-Jul-05 2:20
Brian Delahunty24-Jul-05 2:20 
Generalnmake for c# Pin
Mingzhi_8624-Jul-05 1:11
Mingzhi_8624-Jul-05 1:11 
GeneralRe: nmake for c# Pin
Michael P Butler24-Jul-05 2:12
Michael P Butler24-Jul-05 2:12 
GeneralPopulate values in data grid based on few conditions Pin
lovelylooney23-Jul-05 23:14
lovelylooney23-Jul-05 23:14 
I am trying to populate a grid based on 7 table join. For this I wrote an SQL Query in front end and then I am filling the tables in a Data Set. Everything works fine. But, I have to display two more columns ( Token# and License#) in the data grid based on the same table column (for ex; Ast_Refnr) which I am able to achieve too. I have a Product ID column in table and based on the Product ID value I need to fill the values in the addition columns.

The additional columns that I am displaying or Token# and License#.

If Product ID is 1, then I need to display a value for the column Token# in data grid and License# must be blank. Also, if the Product ID is 4, then I need to display a value in column License# and Token# must be blank.

Since I am populating the above two columns in data grid based on the same table column AST_Refnr value, neither Token# is empty nor License#. I dont know how to use conditions while popualting the Data Grid. Below I am copying a bit of my code which I use for populating data grid.

sSQL = "SELECT A.PRD_PRODUCTTYPE, C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) Token#, " +
"C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) License#, B.PRDD_ProductID, " +
"E.ASTP_TEMPLATENAME, F.ASTS_STATUS_DESCRIPTION, C.AST_REFNR, D.SHP_SHIPDATE FROM " +
"PRODUCT A,PRODUCTDETAIL B,ASSET C,SHIPPING D,ASSETPRODUCTS E,ASSETSTATUS F, Contact G WHERE " +
"A.PRD_PRODUCTID = B.PRDD_PRODUCTID AND B.PRDD_PRODUCT_ORDERID=C.AST_PRODUCT_ORDERID AND " +
"C.AST_ASSETID=D.SHP_ASSETID AND C.AST_DEFID=E.ASTP_DEFID AND C.AST_STATUSID=F.ASTS_STATUSID " +
"AND AST_ICA = '" + SearchForm.strPrimary + "' AND G.CNT_ContactID = D.SHP_contactID " +
"AND A.PRD_DELETED=0 AND B.PRDD_DELETED=0 AND C.AST_DELETED=0 AND D.SHP_DELETED=0 AND " +
"E.ASTP_DELETED =0 AND F.ASTS_DELETED=0 AND G.CNT_Deleted = 0 ORDER BY A.PRD_PRODUCTTYPE";

OdbcDataAdapter da = new OdbcDataAdapter(sSQL, con);
da.Fill(ds, "Product");
da.Fill(ds, "AssetProducts");

dataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGridTableStyle tableStyle = new DataGridTableStyle();

tableStyle.RowHeadersVisible = false;
DataGridTextBoxColumn column1 = new DataGridTextBoxColumn();
column1.MappingName = "PRD_PRODUCTTYPE";
column1.HeaderText = "Product";
column1.Width = 70;
tableStyle.GridColumnStyles.Add(column1);
this.dataGrid1.TableStyles.Add(tableStyle);
tableStyle.MappingName = "Product";

--- This value I need to display in data grid if PRD_ProductID is 1
DataGridTextBoxColumn column6 = new DataGridTextBoxColumn();
column6.MappingName = "Token#";
column6.HeaderText = "Token#/ShippedDate";
column6.Width = 150;
tableStyle.GridColumnStyles.Add(column6);
this.dataGrid1.TableStyles.Add(tableStyle);

--- This value I need to display in data grid if PRD_ProductID is 4
DataGridTextBoxColumn column7 = new DataGridTextBoxColumn();
column7.MappingName = "Lic#";
column7.HeaderText = "License#/ShippedDate";
column7.Width = 150;
tableStyle.GridColumnStyles.Add(column7);
this.dataGrid1.TableStyles.Add(tableStyle);

This forum has helped me a great deal and again I am approaching this for help. Thanks everyone in advance.

Looney
GeneralRe: Populate values in data grid based on few conditions Pin
Alomgir Miah24-Jul-05 11:30
Alomgir Miah24-Jul-05 11:30 
GeneralClass... Arrays... Collections... Arg! Pin
MNiece23-Jul-05 17:29
MNiece23-Jul-05 17:29 
GeneralRe: Class... Arrays... Collections... Arg! Pin
Rob Graham23-Jul-05 18:23
Rob Graham23-Jul-05 18:23 
GeneralRe: Class... Arrays... Collections... Arg! Pin
MNiece25-Jul-05 2:23
MNiece25-Jul-05 2:23 
GeneralRe: Class... Arrays... Collections... Arg! Pin
Rob Graham25-Jul-05 3:25
Rob Graham25-Jul-05 3:25 
GeneralDatagrid Pin
Srinivas Jonnalagadda23-Jul-05 7:45
Srinivas Jonnalagadda23-Jul-05 7:45 
GeneralRe: Datagrid Pin
Christian Graus23-Jul-05 11:02
protectorChristian Graus23-Jul-05 11:02 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 13:27
Srinivas Jonnalagadda23-Jul-05 13:27 
GeneralRe: Datagrid Pin
Christian Graus23-Jul-05 13:50
protectorChristian Graus23-Jul-05 13:50 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 16:02
Srinivas Jonnalagadda23-Jul-05 16:02 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 17:47
Srinivas Jonnalagadda23-Jul-05 17:47 
GeneralRe: Datagrid Pin
Christian Graus24-Jul-05 12:51
protectorChristian Graus24-Jul-05 12:51 
GeneralArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 6:53
Luis Alonso Ramos23-Jul-05 6:53 
GeneralRe: ArrayList of value types Pin
KaptinKrunch23-Jul-05 7:26
KaptinKrunch23-Jul-05 7:26 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 7:45
Wyxlwiis23-Jul-05 7:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 8:27
Luis Alonso Ramos23-Jul-05 8:27 
GeneralRe: ArrayList of value types Pin
DavidNohejl23-Jul-05 8:45
DavidNohejl23-Jul-05 8:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.