Menu

#22 Wrong paramter values in Insert statement by CommandBuilder

open
nobody
None
5
2003-03-22
2003-03-22
Anonymous
No

Patch attached.

Please also change the string concatentations to two
separate Append calls to increase efficiency.

Index: CommandBuilder.cs

==========================
RCS
file: /cvsroot/mysqlnet/mysqlclient/CommandBuilder.cs,v
retrieving revision 1.6
diff -u -r1.6 CommandBuilder.cs
--- CommandBuilder.cs 17 Mar 2003 22:22:18 -
0000 1.6
+++ CommandBuilder.cs 22 Mar 2003 10:46:17 -0000
@@ -296,6 +296,7 @@
cmd.Parameters.Add(p);

setstr.Append( colname );
+ valstr.Append( '@' );
valstr.Append(
p.ParameterName );
}

Regards,
Alan Tam

Discussion

  • Reggie Burnett

    Reggie Burnett - 2003-03-24

    Logged In: YES
    user_id=523261

    signifiant changes were made to COmmandbuilder since 0.68
    as a result of reported bugs. I'm trying to run through some
    unit tests cases so I can put out 0.69 or 0.70. Have you tried
    compiling out of cvs to see if your problem has been fixed?

    Also, I didn't see any patch file other than the diff text above?

    Reggie

     
  • Siggy Loenders

    Siggy Loenders - 2003-03-24

    Logged In: YES
    user_id=733114

    uhm what is valstr ?it gives me an error on it,

    thx in advance

     
  • Nobody/Anonymous

    Logged In: NO

    ``valstr.Append(p.ParameterName );'' is existing code.
    The bug is that it should be
    ``valstr.Append("@" + p.ParameterName );'' instead
    But of course
    ``valstr.Append('@');
    valstr.Append(p.ParameterName );'' is more efficient to run.

    Sorry, I don't know how to attach files. Any instructions?

    Regards,
    Alan Tam

     
  • Siggy Loenders

    Siggy Loenders - 2003-03-25

    Logged In: YES
    user_id=733114

    ok I tried the new versions but now I get an error
    in command.cs

    m_UpdateCount += d.ReadLength();

    the error is " cannot implicity convert type 'int' to 'uint'

     
  • Siggy Loenders

    Siggy Loenders - 2003-03-25

    Logged In: YES
    user_id=733114

    could you mail your bytefx.data.dll to loenders@easynet.be

     
  • Nobody/Anonymous

    Logged In: NO

    Why do you want the binary? I think it doesn't help at all.

     
  • Siggy Loenders

    Siggy Loenders - 2003-03-28

    Logged In: YES
    user_id=733114

    ok ok , I will wait :)

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-03

    Logged In: YES
    user_id=733114

    any update ?

     
  • Reggie Burnett

    Reggie Burnett - 2003-04-03

    Logged In: YES
    user_id=523261

    I just checked in my early work to get multiple resultsets
    supported. That was why you got compile errors on 3/25. I
    was in the middle of a change.

    If you want to compile out of cvs now, it should compile up.
    Also, I have only peformed a couple tests on the new code
    so please report if you see any issues. I will be testing and
    fixing bugs today and tonight so there will be additional
    updates.

    Thanks
    Reggie

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-03

    Logged In: YES
    user_id=733114

    ok I will try tonight or tommorow (its 20.11 here :) )
    keep up the good work

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-03

    Logged In: YES
    user_id=733114

    ok I just tried, there still some bugs in
    mysqlclien\parameter_collection.cs

    Line 25 //
    [Editor(typeof(ByteFX.Data.Common.DBParametersEditor),
    typeof(System.Drawing.Design.UITypeEditor))]

    //

    it also gave me an error with bytefx.snk

    and here
    Line 211

            ArrayList   byteArrays =
    

    new ArrayList();

            foreach \(string sqlstring in
    

    sqlstrings)
    {
    if
    (false)//singleRow)

    bytearrays.Add\( ConvertSqlToBytes\( sqlstring + "
    

    LIMIT 1;" ));
    else

    byteArrays.Add\( ConvertSqlToBytes\( sqlstring
    

    + ";" ));
    //

    }
    In pgsql where also errors, but I don't have it

    So I deleted it in the project (I hoped that all bugs where in
    there :) ), mysqlclient will still work right (well if all mysql
    bugs are fixed )?

    I hope this helps a bit

     
  • Reggie Burnett

    Reggie Burnett - 2003-04-03

    Logged In: YES
    user_id=523261

    make sure you are using the correct references:

    SharpZipLib
    System
    System.Data
    System.Design
    System.Drawing
    System.Drawing.Design
    System.Windows.Forms
    System.XML

    Also, please tell me exactly what errors you are getting. I
    just checked it agian and CVS compiles up just fine for me.

    Thanks
    Reggie

     
  • Reggie Burnett

    Reggie Burnett - 2003-04-03

    Logged In: YES
    user_id=523261

    you will need to comment out the bytefx.snk line as that is
    referencing my key for the project which I will not check in.

    Thanks
    Reggie

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-04

    Logged In: YES
    user_id=733114

    ok commenting the bytefx.snk file fixed all the problems.

    before I got an error in this line
    bytearrays.Add( ConvertSqlToBytes( sqlstring + "
    LIMIT 1;" ));

    bytearrays was unreachable

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-04

    Logged In: YES
    user_id=733114

    this is my code, I used the the mysqlconnection of the
    designer.

    filling of the dataset works, but when I want to update the
    table I get an error "An unhandled exception of
    type 'ByteFX.Data.MySqlClient.MySqlException' occurred in
    system.data.dll

    Additional information: System error."

    Imports ByteFX.Data.MySqlClient

    Public Class frmTest
    Inherits System.Windows.Forms.Form
    Private objdataset As DataSet
    Private objklantadapter As MySqlDataAdapter
    Private objcommandbuilder As MySqlCommandBuilder
    Private objdatareader As MySqlDataReader
    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call
    InitializeComponentEX()
    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal
    disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As
    System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the
    Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents DataGridComboBox1 As
    Microsoft.CLRAdmin.DataGridComboBox
    Friend WithEvents objcnn1 As
    ByteFX.Data.MySqlClient.MySqlConnection
    <System.Diagnostics.DebuggerStepThrough()> Private
    Sub InitializeComponent()
    Me.components = New
    System.ComponentModel.Container()
    Dim configurationAppSettings As
    System.Configuration.AppSettingsReader = New
    System.Configuration.AppSettingsReader()
    Me.objcnn1 = New
    ByteFX.Data.MySqlClient.MySqlConnection(Me.components)
    Me.DataGridComboBox1 = New
    Microsoft.CLRAdmin.DataGridComboBox()
    Me.SuspendLayout()
    '
    'objcnn1
    '
    Me.objcnn1.ConnectionString = CType
    (configurationAppSettings.GetValue
    ("objcnn1.ConnectionString", GetType(System.String)),
    String)
    '
    'DataGridComboBox1
    '
    Me.DataGridComboBox1.DropDownStyle =
    System.Windows.Forms.ComboBoxStyle.DropDownList
    Me.DataGridComboBox1.Location = New
    System.Drawing.Point(168, 48)
    Me.DataGridComboBox1.Name
    = "DataGridComboBox1"
    Me.DataGridComboBox1.Size = New
    System.Drawing.Size(168, 21)
    Me.DataGridComboBox1.TabIndex = 0
    '
    'frmTest
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size
    (5, 13)
    Me.ClientSize = New System.Drawing.Size(600, 419)
    Me.Controls.AddRange(New
    System.Windows.Forms.Control() {Me.DataGridComboBox1})
    Me.Name = "frmTest"
    Me.Text = "Test form"
    Me.ResumeLayout(False)

    End Sub

    #End Region
    Public Sub InitializeComponentEX()

    objdataset = New DataSet()
    objklantadapter = New MySqlDataAdapter("select *
    from tblklant", objcnn1)

    objcnn1.Open()
    Dim objcommandbuilder1 As MySqlCommandBuilder =
    New MySqlCommandBuilder(objklantadapter)
    objklantadapter.MissingSchemaAction =
    MissingSchemaAction.AddWithKey
    objklantadapter.Fill(objdataset, "klanten")
    objcnn1.Close()

    Dim objnewrow As DataRow = objdataset.Tables
    ("klanten").NewRow()

    objnewrow("k_klant_ID") = 12
    objnewrow("k_zaak_ID") = 1
    objnewrow("k_aanspr") = "mr"
    objnewrow("k_famnaam") = "Loenders"
    objnewrow("k_voornaam") = "Siggy"
    objnewrow("k_straat") = "Konijnepijp"
    objnewrow("k_huisnr") = "36"
    objnewrow("k_postcode") = "3920"
    objnewrow("k_woonplaats") = "Lommel"
    objnewrow("k_land_ID") = 1
    objnewrow("k_telnr") = "24314"
    objnewrow("k_groep_ID") = 1
    objnewrow("k_email") = "fdsfds"
    objnewrow("k_klantenkaart") = 1

    objdataset.Tables("klanten").Rows.Add(objnewrow)

    objcnn1.Open()

    objklantadapter.Update(objdataset, "klanten")

    objcnn1.Close()

     
  • Reggie Burnett

    Reggie Burnett - 2003-04-04

    Logged In: YES
    user_id=523261

    Updating of the table using da.Update in my tests works.
    can you send me a file that does not work using the latest
    CVS snapshot?

    Thanks
    Reggie

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-04

    Logged In: YES
    user_id=733114

    do you mean a project of mine ?
    a small test?

     
  • Reggie Burnett

    Reggie Burnett - 2003-04-04

    Logged In: YES
    user_id=523261

    If possible, I would like you to test your code against what is
    in CVS now. If it still fails, then send me the smallest
    example of what fails you can. That way, I can verify it here
    and fix it.

    Thanks
    Reggie

     
  • Siggy Loenders

    Siggy Loenders - 2003-04-04

    Logged In: YES
    user_id=733114

    could you mail the dll to loenders@easynet.be

    if it still fails I will mail you a small vb.net file
    and the create statement for creating my table

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.