locked
Bug generating TabelAdapter on MySql RRS feed

  • Question

  • User-1554671904 posted

    Hi,

    The Dataset/TableAdapter, in Visual Studio 10, asp.net/VB built on  Mysql DB, generate insert/update/delete methods that has parameters named AS @p1 @p2 ... NOT AS the table Fields' Names. This cause two problems 1- during code writing, the name of the poped up parameters is meaningless 2- the GridView built up on that table adapter gives runtime ERROR at delete/update process, the error means that the all parameters of the delete/update method are duplicated, once as p1 p2 .. and another once as the table fields' name in the same method call.

    take a look at the following sample of delete method definition and error:

    XSD:

                    <DeleteCommand>
                      <DbCommand CommandType="Text" ModifiedByUser="false">
                        <CommandText>DELETE FROM `gen_settings` WHERE ((`CompanyNo` = @p1))</CommandText>
                        <Parameters>
                          <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@p1" Precision="0" ProviderType="Int32" Scale="0" Size="0" SourceColumn="CompanyNo" SourceColumnNullMapping="false" SourceVersion="Original" />
                        </Parameters>
                      </DbCommand>
                    </DeleteCommand>

    Error:

    Inner Exception Type: System.InvalidOperationException
    Inner Exception: ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'Delete' that has parameters: p1, original_CompanyNo.
    Inner Source: System.Web

    Note that the same code was used on another developing PC without error, But when I installed a new developing PC I got this problem with the same code, so that I think it is related to the versions or a bug or installation issue.

    Thanks

     

    Thursday, May 15, 2014 3:08 PM

Answers

  • User-166373564 posted

    Hi mohamed.fotoh,

    Welcome to asp.net forum.

                    <DeleteCommand>
                      <DbCommand CommandType="Text" ModifiedByUser="false">
                        <CommandText>DELETE FROM `gen_settings` WHERE ((`CompanyNo` = @p1))</CommandText>
                        <Parameters>
                          <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@p1" Precision="0" ProviderType="Int32" Scale="0" Size="0" SourceColumn="CompanyNo" SourceColumnNullMapping="false" SourceVersion="Original" />
                        </Parameters>
                      </DbCommand>
                    </DeleteCommand>

    According to your description and code above, there is not something wrong with your code, I think this issue is related to machine environment.

    Since I can't reproduce your issue on my side, you can provide me with your scenario below or report it in this site. http://connect.microsoft.com/. Thanks for your understanding.

    Best regards

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 18, 2014 10:04 PM