Click here to Skip to main content
15,904,351 members
Home / Discussions / Database
   

Database

 
GeneralRe: Error when passing multiple values Pin
Mycroft Holmes13-Aug-16 14:04
professionalMycroft Holmes13-Aug-16 14:04 
GeneralRe: Error when passing multiple values Pin
Jassim Rahma15-Aug-16 8:16
Jassim Rahma15-Aug-16 8:16 
GeneralRe: Error when passing multiple values Pin
Mycroft Holmes15-Aug-16 13:02
professionalMycroft Holmes15-Aug-16 13:02 
QuestionHow do Coders Get Database Experts? For a project Pin
TheOnlyRealTodd8-Aug-16 20:58
professionalTheOnlyRealTodd8-Aug-16 20:58 
AnswerRe: How do Coders Get Database Experts? For a project Pin
Mycroft Holmes9-Aug-16 13:04
professionalMycroft Holmes9-Aug-16 13:04 
AnswerRe: How do Coders Get Database Experts? For a project Pin
Nathan Minier10-Aug-16 1:21
professionalNathan Minier10-Aug-16 1:21 
AnswerRe: How do Coders Get Database Experts? For a project Pin
jschell12-Aug-16 11:15
jschell12-Aug-16 11:15 
QuestionHow to pass varchar as WHERE field IN param Pin
Jassim Rahma5-Aug-16 5:14
Jassim Rahma5-Aug-16 5:14 
Hi,

I am trying to pass a varchar string from C# to MySQL stored procedure to be used in WHERE xx IN (param). I tried it in the basic way below but it's not working and giving no result.

can any one help please.

this is my C#:
C#
sql_connection = new MySqlConnection(serverClass.connectionstring("BlueFile", "BlueFile", "Server"));
sql_connection.Open();

sql_command = new MySqlCommand("sp_populate_memo_country_companies", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.AddWithValue("param_country", Convert.ToString(cboToCountry.EditValue)).MySqlDbType = MySqlDbType.VarChar;

// Create data adapter object 
sql_adapter = new MySqlDataAdapter();
sql_adapter.SelectCommand = sql_command;

// Create a dataset object and fill with data using data adapter's Fill method 
data_set = new DataSet();
sql_adapter.Fill(data_set, "companies");
DataViewManager dataview_manager = new DataViewManager(data_set);
DataView main_dataview = dataview_manager.CreateDataView(data_set.Tables["companies"]);

cboToCompany.Properties.ValueMember = "location_id";
cboToCompany.Properties.DisplayMember = "company_name";
cboToCompany.Properties.DataSource = main_dataview;

DevExpress.XtraEditors.Controls.LookUpColumnInfo("department_name", 50, "department_name"));

cboToCompany.Properties.PopupSizeable = false;

cboToCompany.EditValue = null;

and this is my stored procedure:
SQL
SELECT locations.location_id, companies.company_name, locations.location_name, first_payroll, last_payroll
FROM locations
JOIN country ON country.country_code_alpha2 = locations.country_code
JOIN companies ON companies.company_id = locations.company_id
LEFT JOIN payroll ON payroll.location_id = locations.location_id
WHERE locations.country_code IN (param_country) AND payroll_active = TRUE
GROUP BY locations.location_id
ORDER BY companies.company_name;

Thanks,
Jassim[^]

Technology News @ www.JassimRahma.com

AnswerRe: How to pass varchar as WHERE field IN param Pin
Mycroft Holmes5-Aug-16 13:04
professionalMycroft Holmes5-Aug-16 13:04 
AnswerRe: How to pass varchar as WHERE field IN param Pin
David Mujica9-Aug-16 6:20
David Mujica9-Aug-16 6:20 
QuestionIs this SQL query about getting information from all forum users' unread PMs? Pin
Member 1266244831-Jul-16 1:41
Member 1266244831-Jul-16 1:41 
AnswerRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Eddy Vluggen31-Jul-16 2:20
professionalEddy Vluggen31-Jul-16 2:20 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Member 126624481-Aug-16 2:04
Member 126624481-Aug-16 2:04 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Eddy Vluggen1-Aug-16 7:35
professionalEddy Vluggen1-Aug-16 7:35 
AnswerRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
User 1106097931-Jul-16 2:23
User 1106097931-Jul-16 2:23 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Member 126624481-Aug-16 2:01
Member 126624481-Aug-16 2:01 
QuestionRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
User 110609791-Aug-16 2:07
User 110609791-Aug-16 2:07 
AnswerRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Member 126624485-Aug-16 1:04
Member 126624485-Aug-16 1:04 
AnswerRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Richard Deeming1-Aug-16 2:21
mveRichard Deeming1-Aug-16 2:21 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Eddy Vluggen1-Aug-16 10:55
professionalEddy Vluggen1-Aug-16 10:55 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Member 126624485-Aug-16 1:21
Member 126624485-Aug-16 1:21 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Richard Deeming5-Aug-16 1:56
mveRichard Deeming5-Aug-16 1:56 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Member 126624485-Aug-16 1:20
Member 126624485-Aug-16 1:20 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Richard Deeming5-Aug-16 1:53
mveRichard Deeming5-Aug-16 1:53 
GeneralRe: Is this SQL query about getting information from all forum users' unread PMs? Pin
Member 126624485-Aug-16 9:14
Member 126624485-Aug-16 9:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.