i have two table in data source and i need to make a selction with join statment
like:
"SELECT TOP 1000 [TCBatchNo] = tbw.[TCBatchNo],[ModelCode]= wsd.[ModelCode] "
+
"FROM [WorkSetDetail] wsd JOIN [BatchWorkSets] tbw "
"ON wsd.sonumber = tbw.sonumber AND wsd.sotype = tbw.sotype AND wsd.soline = tbw.soline "
"WHERE tbw.[TCBatchNo] ="textbox.text;
and fill the UltraGrid with the result
Hello Hassan,
There are different approaches to solve this task. One of these approaches could ibe if you are using OleDbConnection and OleDbDataAdapter. For example:
System.Data.OleDb.OleDbConnection Conn = new System.Data.OleDb.OleDbConnection("Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=IGBGSOFDS22;Integrated Security=SSPI;Initial Catalog=Test");
System.Data.OleDb.OleDbDataAdapter adap =new System.Data.OleDb.OleDbDataAdapter("select top 50 * from dbItems inner join dbRows on dbItems.ID = dbRows.ID where dbItems.ID > 10", Conn);
DataSet ds = new DataSet();
adap.Fill(ds);
ultraGrid1.DataSource = ds;
The ResultSet of your join will be represent in the grid like a flat data structure. If you want ot represent your data in hierarchical structure, you could use SQL commands Shape and Append to create relation in the resultset between both tabels. For example:
string
sqlcommand = "SHAPE { SELECT ID, sText FROM dbItems WHERE ID =10} APPEND ({SELECT ID, sDescription FROM dbRows } RELATE ID TO ID) as Relation";
Please take a look at the attached sample and video file for more details and let me know if you have any questions.
Regards
Here is the sample