Hi,
I have the following code:
public static DepartmentDetails GetDetails(string Culture, string DepartmentID)
{
// create the connection
MySqlConnection myConnection = new MySqlConnection(ConnectionString);
string CommandText = "SELECT Name FROM department INNER JOIN cultures ON department.CultureID = cultures.CultureID WHERE UICulture = ?Culture AND DepartmentID = ?DepartmentID";
// create the command
MySqlCommand command = new MySqlCommand(CommandText, myConnection);
// add the parameters
MySqlParameter Culture = new MySqlParameter("?Culture", MySqlDbType.String);
Culture.Value = Culture;
command.Parameters.Add(Culture );
MySqlParameter ID = new MySqlParameter("?DepartmentID", MySqlDbType.Int32);
ID.Value = DepartmentID;
command.Parameters.Add(ID );
// The DataTable to be returned
DataTable table;
// Execute the command making sure the connection gets closed in the end
try
{
// Open the data connection
command.Connection.Open();
// Execute the command and save the results in the DataTable
MySqlDataReader reader = command.ExecuteReader();
table = new DataTable();
table.Load(reader);
// Close the reader
reader.Close();
}
finally
{
// Close the connection
command.Connection.Close();
}
// wrap retrieved data into a DepartmentDetails object
DepartmentDetails details = new DepartmentDetails();
if (table.Rows.Count \> 0)
{
details.Name= table.Rows\[0\]\["Name"\].ToString();
}
return details;
}
Everything works in IE but when I test it in Firefox, then I get the following code and the query string seems not returning any value:
table.Rows[0] 'table.Rows[0]' threw an exception of type 'System.IndexOutOfRangeException' System.Data.DataRow {System.IndexOutOfRangeException}
table.Rows[0]["Name"] 'table.Rows[0]' threw an exception of type 'System.IndexOutOfRangeException' object {System.IndexOutOfRangeException}
base {"There is no row at position 0."} System.SystemException {System.IndexOutOfRangeException}
Any help on why I get this problem with firefox? Thanks