DataGrid Update Command in Web Application

I when try to datagrid update get the following error.
there are 3 ID columns.
So my code
And error 'Input string was not in a correct format.'



Answer this question

DataGrid Update Command in Web Application

  • PaulDotNet

    thaks J.13.Leach but again get error.

    Error:


    Input string was not in a correct format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    Line 136:  End Sub
    Line 137:  Private Sub DataGrid1_UpdateCommand1(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand
    Line 138:    Dim GorusmeID As Integer = e.Item.Cells(0).Text
    Line 139:    Dim FirmaID As Integer = e.Item.Cells(1).Text
    Line 140:    Dim GTuru As TextBox = e.Item.Cells(2).Controls(0)


  • Giber

    Your query string has errors in it.

    get rid of the "[" and the "]" In your parameters, like
    @[Grsln Kisi] and they should be one word like @GrslnKisi


    Its ok to use the "[" when you are refering to column names in your table but not in SQL Parameters

    Here is what it the command text etc.

    SqlCom.CommandText = "UPDATE Gorusmeler SET Grsmid=@Grsmid, FirmaID=@FirmaID, [Gorusme Turu]=@Gorusme Turu, Projeid=@Projeid, Konu=@Konu, [Grsln Kisi]=@GrslnKisi, Sonuc=@Sonuc, [Not]=@Not, [Gorusme Zamani]=@GorusmeZamani, [Gorusme Yeri]=@GorusmeYeri WHERE Grsmid=@Grsmid"

    SqlCom.Connection = SqlCon

    With SqlCom.Parameters

    .Add("@Grsmid", GorusmeID)

    .Add("@FirmaID", FirmaID)

    .Add("@GorusmeTuru", GTuru.Text)

    .Add("@Projeid", ProjeID)

    .Add("@Konu", konu.Text)

    .Add("@GrslnKisi", GrslnKisi.Text)

    .Add("@Sonuc", sonuc.Text)

    .Add("@Not", note.Text)

    .Add("@GorusmeZamani", gZamani.Text)

    .Add("@GorusmeYeri", gYeri.Text)




  • hanjg82

    thank you kimble


  • Kevinmac

    That error would typically indicate that the value of e.Item.Cells(0).Text is not a value that can be converted to an integer. When the code fails, what does the debugger list as the value of e.Item.Cells(0).Text



  • DataGrid Update Command in Web Application