Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

using the SqlParameterCollection

$
0
0

Hi,

I got this:

To overcome this, you need to iterate through the source array and add each value to the SqlParameterCollection collection

string[] source = Convert.ToString(cboToCountry.EditValue).Split(new char[] { cboToCountry.Properties.SeparatorChar });

StringBuilder sb = new StringBuilder();

foreach (string s in source)

sql_command.Parameters.AddWithValue("param_country", s.Trim());

not sure how can I use the SqlParameterCollection.

Kindly help..

here is my code:

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", country_codes(Convert.ToString(cboToCountry.EditValue))).MySqlDbType = MySqlDbType.VarChar;

string[] source = Convert.ToString(cboToCountry.EditValue).Split(new char[] { cboToCountry.Properties.SeparatorChar });
StringBuilder sb = new StringBuilder();
foreach (string s in source)
{
sql_command.Parameters.AddWithValue("param_country", s.Trim()).MySqlDbType = MySqlDbType.VarChar;
}

Thanks,

Jassim


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>