J'ai reçu cette exception lors de l'exécution requête de sélection: -J'utilise Visual Composer je reçu cette erreur
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code .The multi-part identifier "sd.MED_ID" could not be bound.
Mon code est
connection conec = new connection();
SqlDataAdapter sqlDataAdapter ;
SqlCommandBuilder sqlCommandBuilder ;
DataSet ds;
private void set_data_Click(object sender, EventArgs e)
{
conec.conopen();
//string query="Select S_ID as 'SYMPTOM NO',SD_ID as 'DISK NO',MED_ID as 'MED NAME',SRO,PNR,SYM as '% SYM',DMD from SYM_DETAIL";
sqlDataAdapter = new SqlDataAdapter("Select SY_DID,S_ID as 'SYMPTOM NO',SD_ID as 'DISK NO',m.med_name as 'MED NAME',SRO,PNR,SYM as '% SYM',DMD from SYM_DETAIL sd"+
"inner join MEDICINE m on sd.MED_ID=m.med_Id where sd.S_ID="+txtbxsymid_update.Text+" and sd.SD_ID="+txtbxdiskid_update.Text+"", conec.con);
ds = new System.Data.DataSet();
sqlDataAdapter.Fill(ds, "SYM_DETAIL");
dataGridView1.DataSource = ds.Tables[0];
L'exception s'indique que votre table de SYM_DETAIL est d'avoir problème tout en se liant à votre code pour med_id. – Deepak
Pouvez-vous nous montrer la structure de votre table pour SYM_DETAIL? – Deepak
Voici la table Structure CREATE TABLE [dbo]. [SYM_DETAIL] ( [SY_DID] NUMERIQUE (18) IDENTITE (1, 1) NON NULL, [S_ID] NUMERIQUE (18) NULL, [SD_ID] NUMERIQUE (18) NULL, [med_id] NUMERIQUE (18) NULL, [SRO] NUMERIQUE (18) NULL, [R/A] NVARCHAR (50) NULL, [DP] NUMERIQUE (18) NULL, [SYM] NUMERIQUE (18) NULL, [NSYM] NUMERIQUE (18) NULL, [DMD] NUMERIQUE (18) NULL, CLAVIER PRIMAIRE ([SY_DID] ASC) ); –