6 Replies - 1810 Views - Last Post: 10 December 2010 - 04:01 PM Rate Topic: -----

#1 Ahmedn1  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 24
  • View blog
  • Posts: 564
  • Joined: 04-August 09

ExecuteNonQuery() problem

Posted 10 December 2010 - 07:58 AM

I use a MySQLCommand to send commands to the db

                command.CommandTimeout = 28800;
                command.CommandType = CommandType.Text;
                command.CommandText = "insert into user_logs (client_id, user_id, thumb_image, large_image, average_activity, log_time) values" +
                    "(" + cid.ToString() + ", " + uid.ToString() + ", '" + Path.GetFileName(thumb) +
                    "', '" + Path.GetFileName(snap) + "', '" + keyStrokes + "/" + (60 / uploadPerHour) + "mins." + "', '" + regDate + "')";
                command.ExecuteNonQuery();



it was working till suddenly it gives me "Fatal Error during command execution" exception
and then closes the connection object

I used the same code in a new project and it worked very fine on the same server I use here

so what?

Is This A Good Question/Topic? 0
  • +

Replies To: ExecuteNonQuery() problem

#2 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1258
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: ExecuteNonQuery() problem

Posted 10 December 2010 - 08:38 AM

If possible can you post the InnerException? Also, does MySQL have some sort of event viewer you can see the logs at? Maybe that will shed some light on what's causing the error.
Was This Post Helpful? 0
  • +
  • -

#3 Ahmedn1  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 24
  • View blog
  • Posts: 564
  • Joined: 04-August 09

Re: ExecuteNonQuery() problem

Posted 10 December 2010 - 09:29 AM

View PostSergio Tapia, on 10 December 2010 - 07:38 AM, said:

If possible can you post the InnerException? Also, does MySQL have some sort of event viewer you can see the logs at? Maybe that will shed some light on what's causing the error.


The inner exception is
"Fatal Error during attempt to read resultset"
Was This Post Helpful? 0
  • +
  • -

#4 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1258
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: ExecuteNonQuery() problem

Posted 10 December 2010 - 10:22 AM

Here's something you can try. Since ExecuteNonQuery is a pretty wrapper method, you can set a breakpoint and start pressing F11, instead of F10. This will drill down INTO that method and there you'll see PRECISELY where things are blowing up.
Was This Post Helpful? 0
  • +
  • -

#5 Ahmedn1  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 24
  • View blog
  • Posts: 564
  • Joined: 04-August 09

Re: ExecuteNonQuery() problem

Posted 10 December 2010 - 02:15 PM

I always use F11
and it just passes through it
Was This Post Helpful? 0
  • +
  • -

#6 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1258
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: ExecuteNonQuery() problem

Posted 10 December 2010 - 03:49 PM

At some point it will choke, what line does it chock on?
Was This Post Helpful? 0
  • +
  • -

#7 Ahmedn1  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 24
  • View blog
  • Posts: 564
  • Joined: 04-August 09

Re: ExecuteNonQuery() problem

Posted 10 December 2010 - 04:01 PM

I solved it
I tried to add this line to each command execution I do

                command.CommandType = CommandType.Text;



and it worked fine
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1