MySql/xyTableAdapters; Inserts, Updates fail

Discussion in 'Databases' started by edkaufmann, Dec 17, 2010.

  1. MySql Insert, Update fails using xyTableAdapters

    whenever my App is updating/inserting a 'Row' I get below errors.
    Reading the tables is no problem!

    On my development system all works fine!

    Question: Do I miss any definition changes on Winhost allowing updates/inserts ? Or VS2008 definitions?

    thanks for your time and hints
    ed

    sample code:
    .....
    DataSetASGB.enrolled.Rows.Add(newenrolledRow);
    enrolledTableAdapter.Update(DataSetASGB.enrolled);
    ....

    My connection strinG:
    <remove name="asgbConnectionString" />
    <add name="asgbConnectionString" connectionString="server=my01.Winhost.com;user id=xyz;password=xyz;database=mysql_11111_xyz;
    persist security info=True;Allow User Variables=True;old guids = true"
    providerName="MySql.Data.MySqlClient" />

    ERROR:
    [MySqlException (0x80004005): INSERT command denied to user 'asgb'@'192.168.110.101' for table 'enrolled']
    System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +1345607
    System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +45
    .... etc. etc

    accoringly when updating the 'Names' table I get similar error:

    UPDATE command denied to user 'asgb'@'78.120.156.26' for table 'Names'
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Who's IP address is 192.168.110.101? This is not us, it is a private IP. Are you sure you have the connection string coded correctly to connect to Winhost MySQL server?
     
    Last edited by a moderator: Oct 14, 2015
  3. Hi Ray,
    I asked the same question you did: this is not my IP address!?

    some more info:
    a) on my system I have locally the very same MySql DB to test i.e. with a different connectionstring pointing to my local DB - ALL is fine.

    b) when using the connection string provided in my 1st msg i.e. running the app on my system and only accessing the MySql DB on Winhost I get this error. However, I can read the DB without any problems.

    c)when running the deployed app on Winhost exactly the same: any update causes this strange error BUT reads are all ok!

    well, will do some more investigation but perhaps you have an idea pointing me in the right direction!
    Thanks for your time
    ed
     
    Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

    Its really hard to troubleshoot a full blown application. As you know, your web application does not have to use the web.config files connection string and it can define its own connection string within the page, so it makes it more difficult to see why the db connection is failing. You may want to review all your web pages and verify what connection string they are using.

    In the meanwhile, you may want to setup a simple app and make sure you are coding the connection string correctly as a test.
     
  5. Hi Ray,
    I agree with your conclusion.It's still a mystery to me but I will further investigate.
    The only difference I see now that I use MySql Server 5.1.53 and Winhost ist on 5.1.7
    Anyway thanks for your time
    ed
     
  6. ... Well after quite some time I found the reason for my problem BUT not the original cause which is: a wrongly generated tableAdapter. (VS2008)

    The INSERT command in the 'viewCode' section of the DataSet' looked like:

    <CommandText>INSERT INTO `abcd`.`enrolled` (`CompetitionsID`, `NamesID`, `DateEnrolled`) VALUES (@CompetitionsID, @NamesID, @DateEnrolled)</CommandText>
    instead of:
    <CommandText>INSERT INTO `enrolled` (`CompetitionsID`, `NamesID`, `DateEnrolled`) VALUES (@CompetitionsID, @NamesID, @DateEnrolled)</CommandText>

    where 'adcd' is the 'user ID' of my MySql DB. Just deleting 'abcd.' solved everything!

    Who knows why the error msg in the end was:
    INSERT command denied to user 'asgb'@'78.120.156.26' for table 'Names'.
    The IP address is whether a valid IP address in my system nor in Winhost's system ...!

    Might be this saves somebodies time and again thanks Ray for yoour patiance!
    ed
    PS : case closed:)
     
    Last edited by a moderator: Oct 14, 2015
  7. Thanks for posting the follow-up, it will help others who run in to a similar problem.
     

Share This Page