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
OK thank you
Thanks for the feedback. It is only one video file. I just split this file into two parts to be able to upload this video in the forum thread
Let me know if you have any further questions.
Hi Georgi,
thank you for you awnser but the Vedio file (Part02) doesn't work (i got an error massage [File is broken])
but the Vedio Part01 is working and it's very helpfull thank you very much !!!, could you please send me the part02 agine ?
This is the second part of video file
I`m not sure that I understnd your scenario, but looking at the provided information, I suppose that you are using TableAdapters to create connections to your database. I suppose that you have two different tables and each of these two tables has own TableAdapter, with own DataSet. If you want to have a join between these two tables and represent the ResultSet into your UltraGrid, you should configure your join direct into your TableAdapter. In this case we will use only one TableAdapter. Please take a look at the attached video file for more details.