1
votes

I'm getting this error on the local computer. But everythings fine on the server! Why?

System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) location: System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) location: System.Convert.ToInt32(String value) location: admin_AddNews.lbAdd_Click(Object sender, EventArgs e) c:\Users***\Documents\Visual Studio 2010\WebSites\Topaloglu\admin\AddNews.aspx.cs içinde: satır 93

I'm using the code below

da.ExecuteNonQuery("INSERT INTO News(NewsPhoto, NewsTitle, NewsSpot, NewsDetail, NewsDate, NewsCategoryID, NewsTop) values(@NewsPhoto, @NewsTitle, @NewsSpot, @NewsDetail, @NewsDate, @NewsCategoryID, @NewsTop)",
                    ImgNameFinal.ToString(), 
                    txtNewsName.Text.ToString(), 
                    txtNewsSpot.Text.ToString(), 
                    txtNewsContent.Content.ToString(), 
                    Convert.ToDateTime(DateTime.Now.ToString()),
                    Convert.ToInt32(ddlKategori.SelectedValue), 
                    Convert.ToBoolean(chkTop.Checked));

If you need my da class ingredient code below

public static string ExecuteNonQuery(String query, params Object[] parameters)
{
    using (SqlConnection connection = new SqlConnection(connection_string))
    {
        try { connection.Open(); }
        catch (Exception ex) { return ex.Message; }

        using (SqlCommand command = connection.CreateCommand())
        {
            command.CommandType = CommandType.Text;
            command.CommandText = query;
            try { DeriveParameters(command, parameters); }
            catch (Exception ex) { return ex.Message; }

            try { return command.ExecuteNonQuery().ToString(); }
            catch (Exception ex) { return ex.Message; }
            finally { connection.Close(); }
        }
    }
}
1
Potentially a difference between how date times' on your machine are represented versus their representation on the server. - Moo-Juice
This error only affected on News table. Other tables' has got date columns and it works correctly. I think chkTop is the error source. But i can't find the solution. - Ghaash

1 Answers

-1
votes

Can you try checking whether the hexadecimal mode is on for Visual Studio on your Local.

Some times , it may accidently switches on when we are navingating around that area.

This might be causing the issue.

Hope this helps..