Hi I have three tables like this
////////////////////////////////////////////
PlaceCodename | DeviceConfig | DevInOut
---------- | ------------ | --------
Place_name | IP (PK) | IP
Place_code (PK) | Place_code | Action
| TypeofUseCode | Cardserial (PK)
| deevNum | date (PK)
| time (PK)
For each Cardserial there are some IPs which can be repeated. It mean the primary key in DevInOut is the combination of (date,time and Cardserial).
I want to give Cardserial and based on the IP ,get Place_code from DeviceConfig and based on that get Place_name from PlaceCodename table.
I wrote this query but it doesn't work:
SqlDataAdapter a = new SqlDataAdapter("select Place_code from DeviceConfig inner join (select IP from DevInOut where Cardserial = '" + textBox12.Text + "') tb on
DeviceConfig.IP = tb.IP)", con);
SqlCommandBuilder comdBuilder = new SqlCommandBuilder(a);
DataTable t = new DataTable();
t.Locale = System.Globalization.CultureInfo.InvariantCulture;
a.Fill(t);
bindingSource1.DataSource = t;
........
I even tried data table it didn't work either.How can I solve my problem?