Click here to Skip to main content
15,923,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.
I wanna delete the special table record with INNER JOIN relationship in ACCESS 2010 and C#.net. but I have following error :

No given for one or more required parameter

SQL
DELETE DISTINCTROW  Ghesting.*
 FROM  ((kala INNER JOIN buyer ON kala.buyer_codem = buyer.code_m_buyer) INNER JOIN Ghesting ON buyer.code_m_buyer = Ghesting.fk_code_m_buyer) 
WHERE ([buyer.code_m_buyer] =[?]) AND (kala.serial_kala=?)
Posted
Updated 22-Mar-15 4:53am
v3

1 solution

You don't really need the JOINs here, as you just want to delete the rows with specific value:
SQL
DELETE FROM Ghesting WHERE fk_code_m_buyer = ?

But you need to supply the parameter: this is the problem that is stated, you did not provide the required parameter.

Maybe:
C#
yourCommandObject.Parameters.AddWithValue("fk_code_m_buyer", yourValue);

should do it.

[EDIT] Solution with the correct example [/EDIT]

SQL
DELETE FROM Ghesting INNER JOIN buyer ON buyer.code_m_buyer = Ghesting.fk_code_m_buyer INNER JOIN kala ON kala.buyer_codem = buyer.code_m_buyer WHERE fk_code_mbuyer = ? AND kala.serial_kala = ?


You still have to provide both parameters when executing the query, though.

As a general advise, you really should normalize the way you are naming your columns, that would make your queries less complicated, more readable, and less prone to typos.
And, second one, when you post a question, please be carefull to give all the relevant and exact details the first time; it will prevent us from wasting our time :)

Kindly.
 
Share this answer
 
v2
Comments
bernova 22-Mar-15 11:00am    
thanks phil.o , but i should pass two parameter to query , because i want to delete special record , not all of records.

the problem is that don't be pass parameters to delete query with innerjoin relationship.

I test my Query in Query design and this error shows in query design not in Visual C#.net
phil.o 22-Mar-15 11:31am    
Please see my updated solution.
bernova 22-Mar-15 11:51am    
Excuse me.
bernova 22-Mar-15 12:01pm    
yet I have following error :
No given for one or more required parameter
phil.o 22-Mar-15 12:04pm    
What do you think that means? :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900